change: Updated push_script_to.sh

This commit is contained in:
Sayantan Santra 2023-05-29 20:08:48 -05:00
parent f22aa445d7
commit 73bcd1ee3c
Signed by: SinTan1729
GPG Key ID: EB3E68BFBA25C85F
1 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# this is a script to push scripts from the folder with git # this is a script to push scripts from the folder with git
# to actual locations where I use them # to actual locations where I use them
@ -7,7 +7,7 @@ if [ -z "$1" ]; then
echo "Provide a script or pass --help to see syntax" echo "Provide a script or pass --help to see syntax"
exit exit
elif [ "$1" == "--help" ];then elif [ "$1" == "--help" ]; then
echo "The syntax is as follows:"$'\n'"push_script_to <script-location> <destination> (additional destinations separated by space)" echo "The syntax is as follows:"$'\n'"push_script_to <script-location> <destination> (additional destinations separated by space)"
exit exit
@ -18,8 +18,7 @@ fi
[ -z "$2" ] && echo "Provide destination(s) or pass --help to see syntax" && exit [ -z "$2" ] && echo "Provide destination(s) or pass --help to see syntax" && exit
for i in "${@:2}" for i in "${@:2}"; do
do
if [ "$i" == "personal_script_dir" ]; then if [ "$i" == "personal_script_dir" ]; then
dest="/home/sintan/.local/bin/personal/" dest="/home/sintan/.local/bin/personal/"
echo Copying to "$dest"... echo Copying to "$dest"...
@ -33,7 +32,7 @@ do
sudo cp "$1" "$dest" sudo cp "$1" "$dest"
echo Making it executable... echo Making it executable...
sudo chmod +x "$dest$(basename "$1")" sudo chmod +x "$dest$(basename "$1")"
elif [ "$i" == "cron_weekly" ]; then elif [ "$i" == "cron_weekly" ]; then
dest="/etc/cron.weekly/" dest="/etc/cron.weekly/"
echo Copying to "$dest"... echo Copying to "$dest"...
@ -55,6 +54,8 @@ do
echo Making it executable... echo Making it executable...
sudo chmod +x "$dest$(basename "$1")" sudo chmod +x "$dest$(basename "$1")"
else echo "Unrecognized destination: $i" else
echo "Unrecognized destination: $i"
echo "Available destinations are: personal_script_dir, cron_daily, cron_weekly, cron_monthly, root_scripts"
fi fi
done done