Wednesday, July 9, 2008

pause before copy : bash script newbie

I already discussed how to write pause function in bash scripting in one of my older post.

Now a simple script to show how that function can be used.

Situation: Your application say "hxes" can process one file at a time (files under its input dir /opt/hxes/input/). You have to copy a set of *.toprocess files to its incoming folder /opt/hxes/input/ in a way such that before copying it waits till you press enter.


read -p "$*"

for file in `ls *.toprocess`
echo "copying $file"
f_pause "Hit Enter key to continue."
cp $file /opt/hxes/input/

No comments:

© Jadu Saikia