Help with first bash script please

Paul Howarth paul at city-fan.org
Thu Oct 21 15:38:53 UTC 2004


Graham Cossey wrote:
> [snip]
> 
>>>Also, does someone have a 'simple' bash scripting resource they
>>
>>could point
>>
>>>me to? I can find plenty of advanced scripting pages but founf
>>
>>nothing with
>>
>>>the above example that worked.
>>
>>Try http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
>>
> 
> 
> Thanks Paul & Filippos for the links, I think the 'intro' would be my best
> starting point...
> 
> Maybe someone needs to come up with a representation for the space character
> in documentation to highlight the fact that a space is required as it is
> easily missed, by me anyway !!

Spaces (also "whitespace", any combination of various space/tab characters) 
can be very important in scripts as field and parameter separators. You'll 
soon get used to it if you write scripts on anything like a regular basis.

I also find it useful to think of the "[" in the "if" statement:

if [ x = y ]; then ...

as being the same as the command "test" (see man test). When you think of it 
("[") as a command (which it is), the need for a space after it is more 
obvious in my mind.

Paul.




More information about the users mailing list