JP Vossen on 24 Apr 2010 12:29:52 -0700


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

Re: [PLUG] Bash script problems - no "function" support?


> Date: Sat, 24 Apr 2010 12:53:48 -0400
> From: Mike Leone <turgon@mike-leone.com>
> Subject: Re: [PLUG] Bash script problems - no "function" support?
> 
> On 04/24/2010 01:15 AM, JP Vossen wrote:
[...]
>> Short answer: somehow you are getting dash, not bash.  
> 
> Yeah, we (Brent and I) eventually figured that out. I was trying to run
> the script as "sh script.sh", and since "sh" is a link to /bin/dash, I
> was not getting it to work. The quick and easy fix was to run it as
> "./script.sh" instead.

Yeah, I get the digest of this list, and saw that after I posted.  Oh well.


>> I was going to accuse you of creating that with Notepad and saving or 
>> copying to Linux, but I get a slightly different error when I do that:
> 
> I use Notepad++, actually, which is (supposed to) be able to save in
> Unix format, and I did tell it to save that way. But .. it didn't. :-)
> So I ended up fixing that by using a "tr" command (that I had to look up
> ...)

Yeah, Notepad++ rules, that's what I use on Windows.  And FYI, Geany and 
SCITE on Linux both use the same base text editing widget.  They 
interfaces are a little different, but not bad.  And I understand that 
NPP runs under Wine OK, but I've never tried.


>> Hummmm...  Not quite the same error.  So maybe only some CRLFs?  Does a 
>> 'dos2unix test.sh' help?  (you probably have to do 'aptitude install 
>> tofrodos' to get dos2unix)  Else, as Brent already suggested:
> 
> Another new useful command (for me). Thanks! :-)

dos2unix and unix2dos have been around forever.  I'm surprised that they 
aren't in the default install; I think they should be.  I can never 
remember the tr command, these are easier.

Later,
JP
----------------------------|:::======|-------------------------------
JP Vossen, CISSP            |:::======|      http://bashcookbook.com/
My Account, My Opinions     |=========|      http://www.jpsdomain.org/
----------------------------|=========|-------------------------------
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug