Click to See Complete Forum and Search --> : What 'if'?


TobyR
06-05-2003, 02:13 PM
Whilst in a "command-line session" [properly called ...?] , I was trying to remember the quickest way to display an interface's config and typed 'if --help'. This appeared to start some program, because the prompt changed to >. I noted that I could type waht ever I wanted and nothing happened - but if I hit the cursor up key then a string of my previously entered 'commands' came up. I CNTL+C to get out of it, but would really like to know what was going on ('man if' was no use). I tried searching for 'Linux if', here and Google, but that wasn't very precise! Any ideas anyone? I'm using Redhat 7.3 (kernel 2.4.18) on a Pentium.

z0mbix
06-05-2003, 02:28 PM
if is a built-in shell command used in a similar situation to:


if [ $NEWIP != $OLDIP ]; then
~/bin/update_dyndns
echo $NEWIP > /etc/currentip
mail -s "New IP: zombix.zombix.org" zombie@zombix.org < /etc/currentip
else
echo "No IP change"
fi

TobyR
06-05-2003, 06:20 PM
Oh I see - thanks.
:)