Link to home
Start Free TrialLog in
Avatar of cgray1223
cgray1223

asked on

Shell Script Command to Determine User Shell

Hello,

I need to write a shell script to set some environment variables. My current version of the script is setup for the bash unix/linux profile.  How can I make the shell script dynamically figure out what shell is currently being used so that I can apply the appropriate environment variable commands?

ANT_HOME=/auto/energywise/apache-ant-1.8.2
export ANT_HOME
Avatar of HndlWCare
HndlWCare

Try this :
ps -ef | grep $$ | awk '{print $8}'
Actually, you might like : ps ef | grep $$ | awk '{print $11}', I'm sure you can find something you like playing around with ps and awk.
Avatar of woolmilkporc
echo $SHELL will do in most cases.
grep `whoami` /etc/passwd | awk -F: '{print NF}
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial