3 ms·
$ cat run-bash-script.sh #!/bin/sh which bash &>/dev/null && exec bash "$@" source /etc/os-release case "$ID" in debian) apt install bash || exit 1
by majewsky 9y ago
$ cat run-bash-script.sh
#!/bin/sh
which bash &>/dev/null && exec bash "$@"
source /etc/os-release
case "$ID" in
debian) apt install bash || exit 1 ;;
redhat|suse) yum install bash || exit 1 ;;
arch) pacman -S bash || exit 1 ;;
alpine) apk add bash || exit 1 ;;
esac
exec bash "$@"
I don't know how to detect and handle the BSDs etc., but you get the idea. ;)
- chubot 9y agoAlso known as, "it's easier to port a shell than a shell script" :)
- deadbunny 9y agoNow go try that on AIX boxes, in banks, where you don't get root/sudo.
- oblio 9y agoYou also don't get internet access, in case a bright bulb tries to go "curl ...". Though in many of these cases I'd just advise leaving the premises unless the salary is stellar (or there are other considerations such as family, etc).
- deadbunny 9y agoOn the DevOps side of things (Contracting in London) the day rate at banks is about 1.5x everywhere else which can be nice. Just as long as you're happy never getting anything done ever.