On Tue, 2 Apr 2024, at 03:24, Karel Lucas wrote: > Instead of ksh I want to use bash as a general shell. But how can I set > it up that way? Bash is already installed.
You're getting plenty of good advice here :-) I have some advice also, hopefully good advice: Firstly, use shellcheck (https://www.shellcheck.net/) to teach you to avoid some of the landmines (but don't blindly trust it; use it as a nudge to read the shell's official docs. Secondly, regardless of the shell you're developing for, specify it correctly in the #! line so shellcheck knows which one you're using. Thirdly, I recommend avoiding using /bin/sh in the #! line if you intend things to be portable because: * on Linux it might be bash or dash or busybox, depending on distribution * on macOS it might be bash or zsh or dash, depending on the state of a symlink, macOS version, the phase of the moon, and other factors (see: man 1 sh) * on OpenBSD it is pdksh in sh compatibility mode (set -o sh) If you use #!/bin/ksh, you should get more consistent behaviour. Fourthly, be aware of which ksh you're actually using. eg. macOS: $ ksh -c 'echo $KSH_VERSION' Version AJM 93u+ 2012-08-01 OpenBSD: $ ksh -c 'echo $KSH_VERSION' @(#)PD KSH v5.2.14 99/07/13.2 Ubuntu 22.04: $ ksh -c 'echo $KSH_VERSION' Version AJM 93u+m/1.0.8 2024-01-01 Alpine Linux: you can install OpenBSD ksh via the 'oksh' package: $ oksh -c 'echo $KSH_VERSION' @(#)PD KSH v5.2.14 99/07/13.2 etc John