Last active
August 29, 2015 14:01
-
-
Save tkuchiki/1c295bad685e5583504a to your computer and use it in GitHub Desktop.
現在の Shell を Shellscript の中から判定する(Linux, BSD 両対応)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_PID=$$; _PPID=$(ps -o ppid -p $_PID | tail -n 1); ps -p $_PPID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
_PID=$$; | |
_PPID=$(ps -o ppid -p $_PID | tail -n 1); | |
if ps -p $_PPID | grep -qs bash ; then | |
echo "bash" | |
elif ps -p $_PPID | grep -qs zsh ; then | |
echo "zsh" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment