Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Last active August 29, 2015 14:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkuchiki/1c295bad685e5583504a to your computer and use it in GitHub Desktop.
Save tkuchiki/1c295bad685e5583504a to your computer and use it in GitHub Desktop.
現在の Shell を Shellscript の中から判定する(Linux, BSD 両対応)
_PID=$$; _PPID=$(ps -o ppid -p $_PID | tail -n 1); ps -p $_PPID
#!/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