Open main menu

ScriptsEdit

Here are some example of basic scripting commands

loopsEdit

Simple for loopEdit

for x in  `ls .tar$` ; do  
echo "gzip $x"
# gzip $x
done



Simple while loop (infanitly repating)Edit

while :
do
tail log.file
sleep 23
clear
done


If ElseEdit

Noarmal wayEdit

if [ -f /usr/bin/sudo ] ; then
        SUDO='/usr/bin/sudo'
else
        SUDO=
fi
echo $SUDO

Sneeky wayEdit

[ -f /usr/bin/sudo ] && SUDO='/usr/bin/sudo' || SUDO= ; echo $SUDO