Sean 'Shaleh' Perry declaimed:
> On Wednesday 05 February 2003 08:48, Georg Nikodym wrote:
> >
> > Lastly:
> >
> >     me=${0##*/}
> >
> > can be rewritten portably:
> >
> >     me=`basename $0`
> >
> > Yes, there's an extra fork/exec but since one tends to limit their
> > setting of a background to once a session, so who gives a rats ass.
> >
> > Hopefully, all that arcana was worth the electrons...
> >
> 
> both 0.65.x and 0.70 branch now have this in the bsetbg code.  Thanks for 
> that.  I actually use the netbsd ash as my /bin/sh and it supports the {##} 
> notation so I never noticed.
> 
> For some of the people newer to UNIX the history lesson was useful I am sure 
> ....
I enjoyed the history very much. I had the pleasure of learning UNIX on
a box with a default Sys V style Bourne shell (AT&T PC7300). csh and ksh
were available, but you had to go get 'em.

One point is that #/bin/sh is generally preferred over #!/bin/bash as a
script header. This works fine because on every Linux system I've fooled
with, /bin/sh is a symlink to /bin/bash. From the Bash man page:

  If  bash  is  invoked  with  the name sh, it tries to mimic the startup
  behavior of historical versions of sh as  closely  as  possible, while
  conforming  to the POSIX standard as well ... 
        
        See the INVOCATION section for the full text.

Regards, Paul

PS: Two questions: 1) I grok basename, but not ${0##*}. Could someone
                explain? 2) Is there really any difference between `basename $0` and
                $(basename $0)?
-- 
Paul Mackinney
[EMAIL PROTECTED]

-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
List archives:  http://asgardsrealm.net/lurker/splash/index.html
Trouble? Contact [EMAIL PROTECTED]

Reply via email to