[clug] can't invoke ex from inside an if statement
Rousak, Boris
Boris.Rousak at actewagl.com.au
Mon Nov 24 15:22:06 EST 2003
Thank you very much. It works now :) This should teach me to be more careful
next time...
-----Original Message-----
From: Kim Holburn [mailto:kim.holburn at anu.edu.au]
Sent: Monday, 24 November 2003 3:17 PM
To: Rousak, Boris; 'CLUG'
Subject: Re: [clug] can't invoke ex from inside an if statement
At 2:57 PM +1100 2003/11/24, Rousak, Boris wrote:
>Greetings all,
>I am stumped on this seemingly obvious problem so any hints/advice would be
>very much appreciated. I wrote the following script using ex:
>
>#!/bin/ksh
>ex - myfile << EOF
>/15:01:06/ | .= | d | a |Nov 14 15:01:06 /usr: 1
>.
>.
>wq
Well you've forgotten the end of the inline redirector:
#!/bin/ksh
ex - myfile << EOF
/15:01:06/ | .= | d | a |Nov 14 15:01:06 /usr: 1
.
.
wq
EOF
>And it works fine, when run from the command line like so ./myscript
>But when I add a simple if statement to the script:
>
>#!/bin/ksh
>if [[ 1 = 1 ]]; then
>{
>ex - myfile << EOF
>/15:01:06/ | .= | d | a |Nov 14 15:01:06 /u20: 1
>.
>.
>wq
>}
>fi
#!/bin/ksh
if [[ 1 = 1 ]]; then
{
ex - myfile << EOF
/15:01:06/ | .= | d | a |Nov 14 15:01:06 /u20: 1
.
.
wq
EOF
}
fi
>and run again I get the following error message:
>./myscript[2]: syntax error at line 4 : `
>where line 4 is the line invoking ex i.e. ex - myfile << EOF.
>I've tested the if statement on its own and it works fine, so does anyone
>have any ideas on what am I doing wrong here?
>
>Cheers,
>Boris
>
>
>************************************************************************
>*PLEASE NOTE* This email and any attachments may
>be confidential. If received in error, please delete all
>copies and advise the sender. The reproduction or
>dissemination of this email or its attachments is
>prohibited without the consent of the sender.
>
>WARNING RE VIRUSES: Our computer systems sweep
>outgoing email to guard against viruses, but no warranty
>is given that this email or its attachments are virus free.
>Before opening or using attachments, please check for
>viruses. Our liability is limited to the re-supply of any
>affected attachments.
>
>Any views expressed in this message are those of the
>individual sender, except where the sender expressly,
>and with authority, states them to be the views of the
>organisation.
>************************************************************************
--
--
Kim Holburn
Network Consultant - Telecommunications Engineering
Research School of Information Sciences and Engineering
Australian National University - Ph: +61 2 61258620 M: +61 0417820641
Email: kim.holburn at anu.edu.au - PGP Public Key on request
Life is complex - It has real and imaginary parts.
Andrea Leistra (rec.arts.sf.written.Robert-jordan)
************************************************************************
*PLEASE NOTE* This email and any attachments may
be confidential. If received in error, please delete all
copies and advise the sender. The reproduction or
dissemination of this email or its attachments is
prohibited without the consent of the sender.
WARNING RE VIRUSES: Our computer systems sweep
outgoing email to guard against viruses, but no warranty
is given that this email or its attachments are virus free.
Before opening or using attachments, please check for
viruses. Our liability is limited to the re-supply of any
affected attachments.
Any views expressed in this message are those of the
individual sender, except where the sender expressly,
and with authority, states them to be the views of the
organisation.
************************************************************************
More information about the linux
mailing list