Re: OT: posix sh problem

2013-04-04 Thread Quartz
I'd really like to have this working cleanly on FreeBSD without requiring any funky shells Define funky shell. Does it have to be straight up plain sh? Can it use csh or tcsh syntax? Does bash count as 'funky'? or using any temporary files. Do you mean manually created temp files?

Re: OT: posix sh problem

2013-04-04 Thread Mark Felder
On Thu, 04 Apr 2013 07:47:09 -0500, Quartz qua...@sneakertech.com wrote: I'd really like to have this working cleanly on FreeBSD without requiring any funky shells Define funky shell. Does it have to be straight up plain sh? Can it use csh or tcsh syntax? Does bash count as 'funky'? Any

Re: OT: posix sh problem

2013-04-04 Thread Quartz
fail on an unwritable filesystem. ...By which I mean you can't create new files because your disk is completely full or you're booting from a ramdisk that's messed up, etc. __ it has a certain smooth-brained appeal

Re: OT: posix sh problem

2013-04-04 Thread Nikos Vassiliadis
On 4/4/2013 3:32 μμ, Mark Felder wrote: Hi all, Hopefully someone here is much more clever than I am. I've run out of ideas on how to cleanly convert this chunk of ksh to posix sh. This is from a BB/Hobbit/Xymon monitoring script for ZFS. I'd really like to have this working cleanly on FreeBSD

Re: OT: posix sh problem

2013-04-04 Thread Teske, Devin
On Apr 4, 2013, at 5:32 AM, Mark Felder wrote: Hi all, Hopefully someone here is much more clever than I am. I've run out of ideas on how to cleanly convert this chunk of ksh to posix sh. /me takes the challenge (and shame on some of the current responses; this is trivial in sh and

Re: OT: posix sh problem

2013-04-04 Thread Mark Felder
On Thu, 04 Apr 2013 08:54:30 -0500, Teske, Devin devin.te...@fisglobal.com wrote: Wait, you can't? Then I've been doing something wrong all these years… #!/bin/sh printf line1\nline2\n | while read line do echo line=[$line] done You sort-of can, but it's not portable at all. As

Re: OT: posix sh problem

2013-04-04 Thread Teske, Devin
On Apr 4, 2013, at 7:42 AM, Mark Felder wrote: On Thu, 04 Apr 2013 08:54:30 -0500, Teske, Devin devin.te...@fisglobal.com wrote: Wait, you can't? Then I've been doing something wrong all these years… #!/bin/sh printf line1\nline2\n | while read line do echo line=[$line] done

Re: OT: posix sh problem

2013-04-04 Thread Teske, Devin
Oh, and just to cover all bases… If you suspect you have sub-shells in the loop, use export to export the vars so that the sub-shells get the vars in the loop. -- Devin On Apr 4, 2013, at 8:04 AM, Teske, Devin wrote: On Apr 4, 2013, at 7:42 AM, Mark Felder wrote: On Thu, 04 Apr 2013

Re: OT: posix sh problem

2013-04-04 Thread Mark Felder
Sorry, my email client did something weird with collapsing and I didn't see you mention that it appeared to be working for you. On Thu, 04 Apr 2013 08:54:30 -0500, Teske, Devin devin.te...@fisglobal.com wrote: The only things I saw that needed changing to go from ksh to /bin/sh were:

Re: OT: posix sh problem

2013-04-04 Thread Teske, Devin
On Apr 4, 2013, at 8:11 AM, Mark Felder wrote: Sorry, my email client did something weird with collapsing and I didn't see you mention that it appeared to be working for you. On Thu, 04 Apr 2013 08:54:30 -0500, Teske, Devin devin.te...@fisglobal.com wrote: The only things I saw that

Re: OT: posix sh problem

2013-04-04 Thread Mark Felder
On Thu, 04 Apr 2013 11:16:11 -0500, Teske, Devin devin.te...@fisglobal.com wrote: Here's what I suggest (the following works for me -- lists all my pools and shows healthy): Fantastic! I'd have never considered wrapping the entire thing into STRING=$STRING$(). I can't tell you how much