1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-27 05:28:37 -06:00

Modify destination options

This commit is contained in:
Sayantan Santra 2022-07-30 02:26:09 -05:00
parent 558a8a0765
commit cef8150084

View file

@ -6,9 +6,11 @@
if [ -z "$1" ]; then 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
elif ! [ -f "$1" ]; then elif ! [ -f "$1" ]; then
echo "The given script doesn't exist" echo "The given script doesn't exist"
exit exit
@ -18,7 +20,7 @@ fi
for i in "${@:2}" for i in "${@:2}"
do do
if [ "$i" == "local_script_dir" ]; then if [ "$i" == "personal_script_dir" ]; then
cp "$1" "/home/sintan/.local/bin/personal/" cp "$1" "/home/sintan/.local/bin/personal/"
chmod +x "/home/sintan/.local/bin/personal/$(basename "$1")" chmod +x "/home/sintan/.local/bin/personal/$(basename "$1")"
@ -26,10 +28,14 @@ do
sudo cp "$1" "/etc/cron.daily/" sudo cp "$1" "/etc/cron.daily/"
sudo chmod +x "/etc/cron.daily/$(basename "$1")" sudo chmod +x "/etc/cron.daily/$(basename "$1")"
elif [ "$i" == "cron_weeky" ]; then elif [ "$i" == "cron_weekly" ]; then
sudo cp "$1" "/etc/cron.weekly/" sudo cp "$1" "/etc/cron.weekly/"
sudo chmod +x "/etc/cron.weekly/$(basename "$1")" sudo chmod +x "/etc/cron.weekly/$(basename "$1")"
elif [ "$i" == "cron_monthly" ]; then
sudo cp "$1" "/etc/cron.monthly/"
sudo chmod +x "/etc/cron.monthly/$(basename "$1")"
else echo "Unrecognized destination: $i" else echo "Unrecognized destination: $i"
fi fi
done done