Scripts that deal with looping (for,while)
#!/bin/bash
# script to monitor who is logged in and what they are doing #
while [ 1 ]
do
clear
echo Last update: $(date)
w
sleep 2
done
exit 0
#!/bin/bash
# script to be used in conjunction with streamripper - after ripping, use this to quickly
# filter the files
cd /tmp/muzak/SomaFM\ presents-\ Indie\ Pop\ Rocks\!\ \[SomaFM\] # this is where the muzak files are
PUT_KEEPERS_HERE=/tmp/keepers # put files I want to keep here
##################################
clear
echo "## Press left/right to seek, RETURN when finished, ctrl-c to exit. duh. ##"
for file in *
do
if [ "$file" != "incomplete" ]
then
echo
echo "playing: $file ... "
mplayer "$file" &>/dev/null
echo "Keep that one? [(y)es, (n)o, (s)kip]"
read action
case "$action" in
"y" )
echo Moving $file to $PUT_KEEPERS_HERE ...
mv "$file" $PUT_KEEPERS_HERE/
;;
"n" )
echo Removing $file ...
rm "$file"
;;
"s" )
echo Skipping $file ...
;;
* )
echo I don\'t know what that meant. Skipping...
;;
esac
fi
done
CarcWiki: Documentation/LinuxCommandLine/Looping (last edited 2006-03-08 10:37:40 by BrianMuller)