IF Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There is no man page for the if command. What you want to look at is
the bash(1) man page, which is a long one.

I am by no means an expert when it comes to bash programming, so I do
stand to be corrected, but from
what I noticed, 2 problems come to mind right away when looking at
your if statement. First, you want to enclose the condition part in
brackets. Second, since file, and number, are shell variables, they should be in all
caps. 

So, rewriting your below code snipit with the 2 fixes I mentioned
would look like:

if [ date -r $FILE +%V -lt $NUMBER ]; then
#statements
fi

Hth.

Greg


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

- -- 
web site: http://www.romuald.net.eu.org
gpg public key: http://www.romuald.net.eu.org/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)

- --
Free domains: http://www.eu.org/ or mail dns-manager at EU.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFESomp7s9z/XlyUyARAlW9AJ96N8O3qTXuKYHVijICUShfjqBSXwCgqRM6
xBTxx4KF10KD3JmTNRTZF/U=
=9OTu
-----END PGP SIGNATURE-----




[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux