IF Help
Ralph W. Reid
rreid at sunset.net
Sun Apr 23 12:49:55 EDT 2006
You were very close for not finding the info in a man page. If I can
assume you are using the bash shell, then the 'if' command is
described somewhere in the midst of the bash man page (it's a _big_
man page, but lots of good stuff is in there).
I suppose you want to use the output of a command in a comparison.
This means that the command should be enclosed in accent marks. Also,
you need some brackets, a semicolon, and the word 'then' to complete
the syntax. Here is what I think you want (note that the spacing
around the brackets is important, as well as all of the punctuation in
the 'if' line):
if [ `date -r $file +%V` -lt $number ]; then
echo It be.
else
echo It be not.
fi
HTH, and have a _great_ day.
On Sat, Apr 22, 2006 at 07:59:24PM +0100, Chris Norman wrote:
> Hi people,
> I want to use the if command, but can't find any manual page for it.
>
> I want to use it to run a command, and at present, I have:
>
> if date -r $file +%V -lt $number; then
> #statements
> fi
>
> But it won't work.
>
> $file is a filename. How do I do this?
>
> Cheers,
>
> Chris Norman
> <!-- chris.norman4 at ntlworld.com -->
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
--
Ralph. N6BNO. Wisdom comes from central processing, not from I/O.
rreid at sunset.net http://personalweb.sunset.net/~rreid
...passing through The City of Internet at the speed of light!
1 = x^0
More information about the Speakup
mailing list