Loginshell or not

  • Canada
  • Windows
  • Mozilla Thunderbird
Sometimes it is useful in a script to know if you are running a login shell or not, in
bash, you can get that information using the
shopt function. For example

if shopt -q login_shell ; then
echo "login"
fi

will only echo login if you are in a login shell..

This is one of the many other tricks that exist:
http://defindit.com/readme_files/bash_examples.html

ciao,

--
Stefan Michalowski
Email: mitch(à)ptaff.ca
PGP Key: http://screamerone.zapto.org/k.asc
 

 

Propulsé par xhtmail