Can I make /bin/sh symlinked to /bin/ksh instead of /bin/dash without breaking anything in the process ? Since they're both supposed to be POSIX-compliant, can I reasonably expect the replacement to go without issues?
Asked
Active
Viewed 471 times
1
Sergiy Kolodyazhnyy
- 107,582
1 Answers
1
/bin/sh was bash for years on Ubuntu, and FWIW it is ksh93 on newer versions of Solaris, so most things should work. If anything, POSIX modes on advanced shells like ksh are more liberal than dash, so some new features are still available:
~ for shell in dash bash ksh zsh; do ARGV0=sh POSIXLY_CORRECT=1 $shell -c 'echo -n $0 {a,b,c}; [[ -z $POSIXL_CORRECT ]] && echo typo'; done
sh {a,b,c}sh: 1: [[: not found
sh a b ctypo
-n sh a b c
typo
sh {a,b,c}typo
$ for shell in dash bash ksh zsh; do ARGV0=sh $shell -c 'echo -n $0 {a,b,c}; [[ -z $POSIXL_CORRECT ]] && echo typo'; done
sh {a,b,c}sh: 1: [[: not found
sh a b ctypo
sh a b ctypo
sh {a,b,c}typo
I don't think any script from a package in Ubuntu relies on dash's lack of brace expansion. A quick scan of scripts in my /usr/bin doesn't show anything like that. There are other modern features available on POSIX-modes of ksh and bash, so it's difficult to predict without actually running the scripts with those shells.
I don't see any benefit to making /bin/sh be ksh, though.
muru
- 207,228