Re: Shell Script (If and Else) problem
On Thu, Dec 01, 2005 at 03:23:32PM +0800, Louie Miranda wrote:
> Im having troubles on my shell script. When i run it, im having this errors.
> ./runXML3.sh: line 18: syntax error near unexpected token `fi'
> ./runXML3.sh: line 18: `fi'
> Im a bit confused how to overcome the problem here. I hope somebody knew
> what can i do here.
> The Code
> #!/bin/sh -x
I'm assuming you use bash (you don't specify).
> if [ -d "$XML_NETWORK_SHARE" ]
> cp $XMLPARSEDFILES/*.xml $XML_FOR_TRANSFER
> cp $XMLPARSEDFILES/*.xml $XML_COPY
> mv $XMLPARSEDFILES/*.xml $XML_NETWORK_SHARE
> mv $XMLPARSEDFILES/*.xml $XML_FOR_TRANSFER
> echo "no network share, not generating XML files"
> mail -s "BCARD V2, no network share - error on XML
> FEED" firstname.lastname@example.org < email_noshare
It should read:
if [ ... ];
(mind the semicolons!)