On 2013-12-13 14:20, Tim Connors wrote:
> On Thu, 12 Dec 2013, Craig Sanders wrote:
> 
> > On Thu, Dec 12, 2013 at 10:33:32PM +1100, Allan Duncan wrote:
> > > I have a rc.local script that runs fine in csh, but I'd like to change
> > > it to sh, but I've had no success at it.
> > >
> > > #! /usr/bin/tcsh
> > > if `ping -w 1 -c 1 -n 192.168.1.3 | grep -o "1 packets"` == "1 packets"
> > > mount /nfs/bulk2
> >
> > the simplest conversion to sh (with some fixes*) would be something like:
> >
> > #!/bin/sh
> > if $(ping -w 1 -c 1 -n 192.168.1.3 | grep -q "1 packets") ; then
> >   mount /nfs/bulk2
> > fi
> 
> bash only.  (ie, #!/bin/bash)

Incorrect. $() is POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03

> Um, no, as I've said before, $() is a bashism.  Yes it is neater, but try
> running that on HP-UX and see how well you go.

Granted, only because HP-UX doesn't necessarily implement current POSIX.

-- 
Regards,
Matthew Cengia

Attachment: signature.asc
Description: Digital signature

_______________________________________________
luv-main mailing list
[email protected]
http://lists.luv.asn.au/listinfo/luv-main

Reply via email to