Potentially inconsistent wordsplitting behaviour on export assignment
- Dominant language
- C
- Stars
- 531
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
According to [wooledge](https://mywiki.wooledge.org/BashPitfalls#local_var.3D.24.28cmd.29) it is possible that a shell may induce wordsplitting on export assignment if the expansion isn't properly quoted (the example is for local but mentions the case is the same for export). The wiki claims dash is susceptible to this but I did not encounter the behaviour:
```sh
#!/bin/sh --
var='contains spaces'
export ENVAR=$var
printf '[%s]\n' "$ENVAR"
```
```sh
% for shell in bash dash sh zsh mksh mrsh; do printf '%s: ' "$shell"; "$shell" foo.sh; done
bash: [contains spaces]
dash: [contains spaces]
sh: [contains spaces]
zsh: [contains spaces]
mksh: [contains spaces]
mrsh: [contains]
```
Of the shells I have, mrsh is the only one which exhibits the behaviour wooledge suggests is possible but I'm unsure if this is a bug or merely a different interpretation of POSIX.
Contributor guide
Assessment
This issue has not been assessed yet.