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

Re: [Sheflug] shell script challenge



And Lo! The Great Prophet Simon Brown uttered these words of wisdom:
> 
> Hmm it doesn't want to play nicely
> /home/simon/listchange.ksh[34]: [: adns-discuss [at] chiark.greenend.org.uk: 
> unexpected operator/operand
> 
> being the error, slightly modified script attached.
> I'm using the public domain ksh that comes with debian BTW which calims to 
> be version 5.2.14
> 

Okay ... I'm assuming ksh93 allows this construct:

	[ -f * ]

where as pdksh (which I think is based on ksh88) doesn't like it. So change 
the test to this:

	[ "`ls`" != "" ]
 
make sure you get the quotes right (those are backticks inside the double 
quotes). And give that a whirl; that should be universally supported right 
down to bog standard sh.

Chris...

-- 
\ Chris Johnson           \ NP: Dido - 12. Take My Hand
 \ cej [at] nightwolf.org.uk    ~-----,   
  \ http://cej.nightwolf.org.uk/  ~-----------------------------------, 
   \ Redclaw chat - http://redclaw.org.uk - telnet redclaw.org.uk 2000 \____



___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.