Reputation: 53
I am creating a Loop that will let me rsync files from a variable directory one level above and then bzip those files at every level, infinitely until I press CTRL+C. So far this is what I have for the shell script:
while :
do
rsync -av ../gene/ .
bzip2 -kv */*/*/*/*/*/*/*
bzip2 -kv */*/*/*/*/*/*
bzip2 -kv */*/*/*/*/*
bzip2 -kv */*/*/*/*
bzip2 -kv */*/*/*
bzip2 -kv */*/*
bzip2 -kv */*
echo "Press [CTRL+C] to stop.."
sleep 1
done
What I would like to have happen is it ask for the directory that it should rsync from. The directory is not always gene and is variable, so user input is a must. Any help with this and possibly cleaning the script up is much appreciated.
Upvotes: 1
Views: 68
Reputation: 1254
You could do this:
#!/bin/bash
myFolder=$1;
echo "Working on "$myFolder;
while :
do
rsync -av $myFolder .
bzip2 -kv */*/*/*/*/*/*/*
bzip2 -kv */*/*/*/*/*/*
bzip2 -kv */*/*/*/*/*
bzip2 -kv */*/*/*/*
bzip2 -kv */*/*/*
bzip2 -kv */*/*
bzip2 -kv */*
echo "Press [CTRL+C] to stop.."
sleep 1
done
save with the name someprogram.sh
and excute (if you are there)
bash ./someprogram.sh someFolder
Upvotes: 1