Installing and Switching Shells
·
1 min read
·
113
Words
·
-Views
-Comments
While adding shell hooks to a web shell project, I hit a few quirks. Here’s a cheat sheet for installing various shells and switching between them, using Ubuntu as the example OS.
Bash
chsh -s $(which bash)
# Version
bash --version
Zsh
sudo apt install zsh
chsh -s $(which zsh)
# Version
zsh --version
Fish
sudo apt install fish
sudo chsh -s $(which fish)
Tcsh
sudo apt install tcsh
chsh -s $(which tcsh)
Notable Differences
In Bash and Zsh,
printf "PreExecMarker;$1";
doesn’t escape arguments, so placeholders likedate +%Y
can trigger errors. Fish and Tcsh automatically escape arguments and avoid the issue.Fix it by specifying the format explicitly:
printf "PreExecMarker;%s" "date +%Y"