|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Greetings,
Correct me if I am wrong, but the parameter expansion ${var/PATTERN/ STRING} (as well as ${var:OFFSET:LENGTH}) is not defined in the POSIX specification [http://www.opengroup.org/onlinepubs/...399/utilities/ xcu_chap02.html#tag_02_06_02]. I don't understand why running Bash under POSIX mode [http://theory.uwinnipeg.ca/gnu/bash/bashref_66.html] does not yield an error when such a substitution is used. Thanks in advance for your . Best regards, Ezequiel |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Wed, 9 Jan 2008 06:53:11 -0800 (PST), Eze wrote:
[...] > Correct me if I am wrong, but the parameter expansion ${var/PATTERN/ > STRING} (as well as ${var:OFFSET:LENGTH}) is not defined in the POSIX > specification [http://www.opengroup.org/onlinepubs/...399/utilities/ > xcu_chap02.html#tag_02_06_02]. I don't understand why running Bash > under POSIX mode [http://theory.uwinnipeg.ca/gnu/bash/bashref_66.html] > does not yield an error when such a substitution is used. [...] bash --posix enables the POSIX mode of bash. That is bash will interpret POSIX scripts the way it is specified by the POSIX specification. The ${var:OFFSET:LENGTH} syntax is not POSIX, so an interpreter is allowed to behave however it wants, wether issuing a syntax error message or playing a tune or behaving as bash does. -- Stephane |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Thanks Stephane,
My next question then is whether there is a shell that you would recommend that adheres as closely as possible to POSIX (that is, POSIX and nothing else) under a suitable mode. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Wed, 09 Jan 2008 08:29:39 -0800, Eze wrote:
> Thanks Stephane, > > My next question then is whether there is a shell that you would > recommend that adheres as closely as possible to POSIX (that is, POSIX > and nothing else) under a suitable mode. A common answer is ash or dash. http://gondor.apana.org.au/~herbert/dash/ |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Thanks to both of you.
|
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On Wed, 9 Jan 2008 08:29:39 -0800 (PST), Eze wrote:
[...] > My next question then is whether there is a shell that you would > recommend that adheres as closely as possible to POSIX (that is, POSIX > and nothing else) under a suitable mode. See debian's posh (policy orientated shell). It's based on pdksh, and the maintainers tried to remove the features that were not POSIX. -- Stephane |
|
![]() |
| Outils de la discussion | |
|
|