I tried different variants
echo $0
echo $shell
echo $SHELL
ps -p $$
but none of them can give a distinctive output. I can do something like this but it's ugly and hackish:
if ls --help 2>&1 | grep BusyBox; then
echo "it is BusyBox"
else
echo "it is NOT BusyBox"
fi
Another way requiring Linux and readlink
:
#!/bin/ash
exe=`exec 2>/dev/null; readlink "/proc/$$/exe"`
case "$exe" in
*/busybox)
echo "It's a busybox shell."
;;
esac
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With