mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
notes: decide to follow regular bash behaviour, not POSIX
This commit is contained in:
parent
806e98ac97
commit
78298fbb1d
1 changed files with 6 additions and 15 deletions
21
NOTES.md
21
NOTES.md
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
cf. [Bash Reference Manual](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html)
|
cf. [Bash Reference Manual](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html)
|
||||||
|
|
||||||
Comparative testing with bash should be done with bash --norc --posix.
|
Comparative testing with bash should be done with bash --norc.
|
||||||
|
|
||||||
|
In case of difference between regular bash and posix bash, we decide to follow regular bash.
|
||||||
|
|
||||||
## Ideas for testing
|
## Ideas for testing
|
||||||
* use prysk or shellspec with shell=./minishell
|
* use prysk or shellspec with shell=./minishell
|
||||||
|
|
@ -339,27 +341,16 @@ The word following the redirection operator, unless otherwise noted, is
|
||||||
subjected to parameter expansion, filename expansion, word splitting, and
|
subjected to parameter expansion, filename expansion, word splitting, and
|
||||||
quote removal.
|
quote removal.
|
||||||
|
|
||||||
If it expands to more than one word, Bash reports an error, except when in posix
|
If it expands to more than one word, Bash reports an error.
|
||||||
mode.
|
|
||||||
TODO: decide if we follow posix default or bash default
|
|
||||||
|
|
||||||
Note: This behaviour change is, as far as I can tell, not documented in the Bash
|
|
||||||
Reference Manual.
|
|
||||||
|
|
||||||
|
This is the correct behaviour:
|
||||||
```shell
|
```shell
|
||||||
# bash behaviour
|
|
||||||
bash-5.1$ var="file1 file2"
|
bash-5.1$ var="file1 file2"
|
||||||
bash-5.1$ echo "hello world" > $var
|
bash-5.1$ echo "hello world" > $var
|
||||||
bash: $var: ambiguous redirect
|
bash: $var: ambiguous redirect
|
||||||
# posix behaviour
|
|
||||||
bash-5.1$ var="file1 file2"
|
|
||||||
bash-5.1$ echo "hello world" > $var
|
|
||||||
bash-5.1$ cat "$var"
|
|
||||||
hello world
|
|
||||||
```
|
```
|
||||||
|
|
||||||
In bash mode and in posix mode, if the variable is not defined, bash prints the
|
If the variable is not defined, bash prints the following error:
|
||||||
following error:
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
bash-5.1$ echo "hello world" > $nonexist
|
bash-5.1$ echo "hello world" > $nonexist
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue