Last active
May 6, 2024 14:46
-
-
Save fabiolimace/7d1e2e592257e916fe101fe3dddc1e84 to your computer and use it in GitHub Desktop.
Install scripts in `/usr/local/bin`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# | |
# Install script files located in /usr/local/bin/scripts into /usr/local/bin | |
# | |
# First, put the scripts you want to install inside /usr/local/bin/scripts; then run this script. | |
# | |
# The script will look for files with these extensions: awk, py, sh. | |
# | |
bin=/usr/local/bin; | |
scripts=$bin/scripts; | |
regex=".*\.\(awk\|py\|sh\)"; | |
function symbolic-link { | |
local file=${1} | |
local type=${1##*.} | |
echo ln -s $file $bin/`basename $file .$type`; | |
sudo ln -s $file $bin/`basename $file .$type`; | |
} | |
for i in `find $scripts -type f -regex "$regex"`; | |
do | |
echo chmod +x $i; | |
sudo chmod +x $i; | |
symbolic-link $i; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment