[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed
From: |
Stephane Chazelas |
Subject: |
Re: sed |
Date: |
Thu, 15 Feb 2007 19:13:22 +0000 |
User-agent: |
Mutt/1.5.6i |
On Wed, Feb 14, 2007 at 11:16:23AM -0600, Matthew Woehlke wrote:
[...]
> Right. And if you use '#!/bin/bash' on Solaris, you're screwed. I'll
> stick to writing /portable/ scripts, thank you.
[...]
I use:
#! /bin/sh -
# ensure `POSIX' shell for Solaris
false ^ true && [ -x /usr/xpg4/bin/sh ] &&
exec /usr/xpg4/bin/sh - "$0" ${1+"$@"}
# ensure POSIX utilities
PATH=$(command -p getconf PATH; :)${PATH:+:}$PATH
That's for Solaris+systems with /bin/sh being POSIX. If another
system with a /bin/sh not being POSIX was to be supported, I
would simply have to adapt those lines a bit. But I wouldn't
have to rewrite the script as when you need to port to another
variant of the Bourne shell or utilities.
(the irony is that the two first lines of code above are not
POSIX conformant (#! and ^ are unspecified)).
--
Stéphane
- sed, Conner, Neil, 2007/02/12
- Re: sed, Stephane Chazelas, 2007/02/13
- Re: sed, Stephane Chazelas, 2007/02/13
- Re: sed, Matthew Woehlke, 2007/02/13
- Message not available
- Re: sed, Stephane Chazelas, 2007/02/13
- Re: sed, Matthew Woehlke, 2007/02/13
- Message not available
- Re: sed, Stephane Chazelas, 2007/02/14
- Re: sed, Matthew Woehlke, 2007/02/14
- Message not available
- Re: sed,
Stephane Chazelas <=
Re: sed, Ralf Wildenhues, 2007/02/13
- RE: sed, Conner, Neil, 2007/02/13
- Re: sed, Stephane Chazelas, 2007/02/14
Re: sed, Stephane Chazelas, 2007/02/14
Re: sed, Ralf Wildenhues, 2007/02/14