Skip to content

Instantly share code, notes, and snippets.

@chisui
Created May 21, 2023 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chisui/2f577ec94fe4fe7651014c247780522b to your computer and use it in GitHub Desktop.
Save chisui/2f577ec94fe4fe7651014c247780522b to your computer and use it in GitHub Desktop.
#! zsh
NIX_EXECUTING_SHELL=$(readlink /proc/nope/exe)
echo \"$NIX_EXECUTING_SHELL\"
if [[ -z "$NIX_EXECUTING_SHELL" ]] && command -v lsof &> /dev/null
then
echo "no proc"
NIX_EXECUTING_SHELL=$(lsof -p $$ | awk '$4=="txt" {print $9}' | head -n 1)
fi
echo $NIX_EXECUTING_SHELL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment