[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'set +o' or '. /dev/fd/0' or?...
From: |
Eric Blake |
Subject: |
Re: 'set +o' or '. /dev/fd/0' or?... |
Date: |
Mon, 13 Jul 2009 05:26:56 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Alfred M. Szmidt on 7/13/2009 5:06 AM:
> { set +o; COMMAND; } | sh
Required by POSIX, but some older shells don't handle it well. Solaris
/bin/sh appears to just ignore it. Older ash gives output that cannot be
reparsed as valid commands.
> COMMAND | . /dev/fd/0
Depends on the file system providing it. But named fifos might be more
widely supported; does this look any better?
mkfifo fifo
(COMMAND >fifo)&
. fifo
rm fifo
> Can't you use? COMMAND | sh +x
No, that always sets +x in the child shell, even when it was not set in
the parent.
Or, one other idea:
{ echo "set -$-"; COMMAND; } | sh
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkpbGf8ACgkQ84KuGfSFAYDvhwCcC7ax2HnE1GjcXRADBREe45jI
2gkAnjG4JmP79aAOxJMCQNuJcDW1IBya
=mHxP
-----END PGP SIGNATURE-----