bash errorif: Expression Syntax
Lennart Sorensen
lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Sat Dec 10 16:17:54 UTC 2005
On Sat, Dec 10, 2005 at 07:05:50AM -0800, J. Qiang Li wrote:
> hello, all
>
> i have a simple bash script that giving me problem under solaris.
>
> run "source my_script", got error: "if: Expression Syntax"
Why are you using source? sh/bash uses . not source. csh uses source
and you can't source an sh/bash script when running csh. You can run it
though, which is what ./script does. sh script would have also worked.
Most likely it is just that whatever shell you are in doesn't do sh
syntax if statements.
> then i chmod +x on my_script and invoke it with ./my_script , it worked. why? i am including this
> script as postinstall in a solaris package, it failed to get invoked at the postinstall stage. how
> do i fix that?
>
> it's a simple script as
>
> #!/bin/sh
> if [ -e 'file' ]; then
> echo "something"
> fi
Looks fine.
Len Sorensen
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list