* Re: IF Help
IF Help Chris Norman
@ ` Gregory Nowak
` Georgina Joyce
` Ralph W. Reid
2 siblings, 0 replies; 7+ messages in thread
From: Gregory Nowak @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
-----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@ntlworld.com -->
> _______________________________________________
> Speakup mailing list
> Speakup@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@EU.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQFESomp7s9z/XlyUyARAlW9AJ96N8O3qTXuKYHVijICUShfjqBSXwCgqRM6
xBTxx4KF10KD3JmTNRTZF/U=
=9OTu
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: IF Help
IF Help Chris Norman
` Gregory Nowak
@ ` Georgina Joyce
` Chris Norman
` ace
` Ralph W. Reid
2 siblings, 2 replies; 7+ messages in thread
From: Georgina Joyce @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
Hi
As it is bash scripting, just type at your prompt "help if". Looks like we're on our own in trying to do these little jobs.
Gena
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@ntlworld.com -->
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
---end quoted text---
--
2E0AXU
Freedom & Power provided by debian GNU Linux
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: IF Help
` Georgina Joyce
@ ` Chris Norman
` ace
1 sibling, 0 replies; 7+ messages in thread
From: Chris Norman @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
Cheers.
Chris Norman
<!-- chris.norman4@ntlworld.com -->
----- Original Message -----
From: "Georgina Joyce" <gena@genaj.plus.com>
To: "Speakup is a screen review system for Linux." <speakup@braille.uwo.ca>
Sent: Sunday, April 23, 2006 12:03 AM
Subject: Re: IF Help
> Hi
>
> As it is bash scripting, just type at your prompt "help if". Looks like
> we're on our own in trying to do these little jobs.
>
> Gena
> 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@ntlworld.com -->
>> _______________________________________________
>> Speakup mailing list
>> Speakup@braille.uwo.ca
>> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>>
> ---end quoted text---
>
> --
> 2E0AXU
>
> Freedom & Power provided by debian GNU Linux
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: IF Help
` Georgina Joyce
` Chris Norman
@ ` ace
1 sibling, 0 replies; 7+ messages in thread
From: ace @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
there is also a good shell programmers' tutorial at
www.blindprogramming.com under the UNIX section, I think.
At 07:03 PM 4/22/2006, you wrote:
>Hi
>
>As it is bash scripting, just type at your prompt "help if". Looks
>like we're on our own in trying to do these little jobs.
>
>Gena
>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@ntlworld.com -->
> > _______________________________________________
> > Speakup mailing list
> > Speakup@braille.uwo.ca
> > http://speech.braille.uwo.ca/mailman/listinfo/speakup
> >
>---end quoted text---
>
>--
>2E0AXU
>
>Freedom & Power provided by debian GNU Linux
>
>_______________________________________________
>Speakup mailing list
>Speakup@braille.uwo.ca
>http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: IF Help
IF Help Chris Norman
` Gregory Nowak
` Georgina Joyce
@ ` Ralph W. Reid
` Chris Norman
2 siblings, 1 reply; 7+ messages in thread
From: Ralph W. Reid @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
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@ntlworld.com -->
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
--
Ralph. N6BNO. Wisdom comes from central processing, not from I/O.
rreid@sunset.net http://personalweb.sunset.net/~rreid
...passing through The City of Internet at the speed of light!
1 = x^0
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: IF Help
` Ralph W. Reid
@ ` Chris Norman
0 siblings, 0 replies; 7+ messages in thread
From: Chris Norman @ UTC (permalink / raw)
To: Speakup is a screen review system for Linux.
Cheers mate.
Chris Norman
<!-- chris.norman4@ntlworld.com -->
----- Original Message -----
From: "Ralph W. Reid" <rreid@sunset.net>
To: "Speakup is a screen review system for Linux." <speakup@braille.uwo.ca>
Sent: Sunday, April 23, 2006 5:49 PM
Subject: Re: IF Help
> 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@ntlworld.com -->
>> _______________________________________________
>> Speakup mailing list
>> Speakup@braille.uwo.ca
>> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
> --
> Ralph. N6BNO. Wisdom comes from central processing, not from I/O.
> rreid@sunset.net http://personalweb.sunset.net/~rreid
> ...passing through The City of Internet at the speed of light!
> 1 = x^0
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 7+ messages in thread