bash errorif: Expression Syntax

Chris F.A. Johnson cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Sat Dec 10 19:40:45 UTC 2005


On Sat, 10 Dec 2005, 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 are mostly right. but 'source' works for bash as well, just not
> sh based on the book 'unix power tools'.  >

    You are mostly right; "source" works for bash (and csh, but that's
    an altogether different kettle of fish), but not for sh or ksh.

    You cannot source a bash (or sh) script from within csh.

> anyway, took bit of time to find a good reference on various bourne
> shell. problem solved by using the correct test. this is a good read
> http://www.in-ulm.de/~mascheck/bourne/

    For more links, see my shell page (in my .sig).

-- 
    Chris F.A. Johnson                <http://cfaj.freeshell.org/shell>
    ===================================================================
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
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