Jon Nelson on 20 Nov 2007 15:08:19 -0000


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

Re: [PLUG] Perl backticks/system question


On Mon, 2007-11-19 at 15:34 -0500, JP Vossen wrote:
> > Date: Mon, 19 Nov 2007 13:59:05 -0500
> > From: Jon Nelson <lists@linuxnotes.net>
> > 
> > I tried using open() and got the same results.  The script is really
> > nothing but a one-liner that caused more errors when I tried to run it
> > from within perl:
> > 
> >     #!/bin/sh
> >     IFS=$"\n"
> >     strings $1 | egrep -i "^[a-z]{1}:.*$2$"
> 
> Style note: the IFS=$'' (or presumably IFS=$"") notation is bash and ksh 
> specific.  It's not portable, thus using #!/bin/sh will fail on 
> non-Linux systems, and I'm not sure what dash (which is /bin/sh on 
> Ubuntu and soon Debian) will do.  It's also unclear to the reader since 
> the script requires bash but specified bourne.  The shebang line should 
> be "#!/bin/bash" or for best portability "#!/usr/bin/env bash".
> 
> Now that I got that off my chest...  :-)

Point taken...

___________________________________________________________________________
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