#!/bin/bash

Jeremy Henty jeremy.henty at nec.ac.uk
Wed Jan 11 16:04:08 GMT 2006


    [ The following text is in the "iso-8859-1" character set. ]
    [ Your display is set for the "US-ASCII" character set.  ]
    [ Some characters may be displayed incorrectly. ]

On Wednesday, January 11, 2006 2:20 pm, Spicer, Kevin <KevinS at BMRB.CO.UK> wrote:
>On Wed, 11 Jan 2006 04:10:51 +0000 Julian Field
><mailscanner at ECS.SOTON.AC.UK> wrote:
>
>> What else should I be looking for? I tend to write for whatever  
>> version of sh happens to be on the system I'm writing on at
>>the time.

Don't use $( ... ) .  Vanilla sh will only recognise backticks ` ... ` .

>I always get bitten by 
>
>if [ "X$something" == "something" ]; then
>
>which works fine on bash, but sh only wants a single =

test and [ are builtins in bash, but sh calls the executable in /bin which 
doesn't recognise == .

$ test 6 == 7
$ /bin/test 6 == 7
test: ==: unknown operand
$ [ 6 == 7 ]
$ /bin/[ 6 == 7 ]
[: ==: unknown operand

Cheers, 

Jeremy Henty 

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki (http://wiki.mailscanner.info/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

Support MailScanner development - buy the book off the website!



More information about the MailScanner mailing list