<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: What command to determine the current shell? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903097#M105437</link>
    <description>One of the most important shell scripting techniques is to always define how the script is to be run. Line #1 should always be #! followed by the full pathname of the desired shell. This is also known as the courtesy loader or shell loader. Script writers that use Perl must always use the line since none of the shells know anything about Perl. In general, knowing the current shell is not too important as long as scripts define what they need in line #1.</description>
    <pubDate>Thu, 13 Feb 2003 22:11:30 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2003-02-13T22:11:30Z</dc:date>
    <item>
      <title>What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903075#M105415</link>
      <description>I have env variables and aliases in .cshrc but I wonder which file determines what default shell I use upon login?&lt;BR /&gt;&lt;BR /&gt;Shawn</description>
      <pubDate>Wed, 12 Feb 2003 19:32:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903075#M105415</guid>
      <dc:creator>Shawn_45</dc:creator>
      <dc:date>2003-02-12T19:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903076#M105416</link>
      <description>Echo $SHELL&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 12 Feb 2003 19:35:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903076#M105416</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-02-12T19:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903077#M105417</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Your shell is set in /etc/passwd and exec'd when you login.&lt;BR /&gt;&lt;BR /&gt;If you want to see what shell you are running, you can do:&lt;BR /&gt;&lt;BR /&gt;echo $SHELL&lt;BR /&gt;&lt;BR /&gt;[at least in ksh and POSIX sh, I'm not sure about csh].&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Feb 2003 19:36:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903077#M105417</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-02-12T19:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903078#M105418</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;#echo $SHELL&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Jeff</description>
      <pubDate>Wed, 12 Feb 2003 19:37:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903078#M105418</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2003-02-12T19:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903079#M105419</link>
      <description>It is usually specifies in the /etc/password file for each user what shell or script to execute at login.</description>
      <pubDate>Wed, 12 Feb 2003 19:37:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903079#M105419</guid>
      <dc:creator>Ken Hubnik_2</dc:creator>
      <dc:date>2003-02-12T19:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903080#M105420</link>
      <description>Hi Shawn:&lt;BR /&gt;&lt;BR /&gt;A user's default shell for login is defined in '/etc/passwd'.&lt;BR /&gt;&lt;BR /&gt;For the c-shell, 'etc/csh.login' is sourced (read/executed) before '$HOME/.cshrc' and '$HOME/.login'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...  &lt;BR /&gt;</description>
      <pubDate>Wed, 12 Feb 2003 19:38:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903080#M105420</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-02-12T19:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903081#M105421</link>
      <description>Your default shell will be taken from the /etc/passwd file, as set when the account was created. Depend up on that values, it executes the proper profile files from your $HOME directory.&lt;BR /&gt;&lt;BR /&gt;# echo $SHELL will tell you the current shell.</description>
      <pubDate>Wed, 12 Feb 2003 19:39:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903081#M105421</guid>
      <dc:creator>Helen French</dc:creator>
      <dc:date>2003-02-12T19:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903082#M105422</link>
      <description>By the way, it's the last column in /etc/passwd.&lt;BR /&gt;&lt;BR /&gt;Good luck,&lt;BR /&gt;&lt;BR /&gt;Vince</description>
      <pubDate>Wed, 12 Feb 2003 19:39:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903082#M105422</guid>
      <dc:creator>Vincent Fleming</dc:creator>
      <dc:date>2003-02-12T19:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903083#M105423</link>
      <description>the shell you use is in /etc/passwd. However you can overide that by putting another shell in your profile.&lt;BR /&gt;&lt;BR /&gt;This will spanwned by your shell in /etc/passwd.&lt;BR /&gt;&lt;BR /&gt;echo $SHELL&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Feb 2003 19:39:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903083#M105423</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2003-02-12T19:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903084#M105424</link>
      <description>Okay, I can login to a user account who has csh as the default shell.&lt;BR /&gt;&lt;BR /&gt;I need to do something in a loop, so I run&lt;BR /&gt;% ksh&lt;BR /&gt;% echo $SHELL&lt;BR /&gt;/usr/bin/csh&lt;BR /&gt;&lt;BR /&gt;Is there a way to do as the first question asks and get your current shell?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shannon</description>
      <pubDate>Wed, 12 Feb 2003 19:40:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903084#M105424</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2003-02-12T19:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903085#M105425</link>
      <description>#env&lt;BR /&gt;&lt;BR /&gt;and look for ENV=</description>
      <pubDate>Wed, 12 Feb 2003 20:03:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903085#M105425</guid>
      <dc:creator>Paul Sperry</dc:creator>
      <dc:date>2003-02-12T20:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903086#M105426</link>
      <description>#env&lt;BR /&gt;&lt;BR /&gt;and look for SHELL=</description>
      <pubDate>Wed, 12 Feb 2003 20:03:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903086#M105426</guid>
      <dc:creator>Paul Sperry</dc:creator>
      <dc:date>2003-02-12T20:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903087#M105427</link>
      <description>Shannon has an excellent point.&lt;BR /&gt;&lt;BR /&gt;I've blindly assumed for years that $SHELL contains your current shell.  It seems that that is not the case - it's the shell that you're assigned from /etc/passwd by login.&lt;BR /&gt;&lt;BR /&gt;Hmmmmm!&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 12 Feb 2003 20:10:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903087#M105427</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-02-12T20:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903088#M105428</link>
      <description>echo $SHELL&lt;BR /&gt;&lt;BR /&gt;or use a typo like lsls and it will come back saying &lt;BR /&gt;&lt;BR /&gt;sh : lsls not found&lt;BR /&gt;&lt;BR /&gt;/bin/ksh : lsls not found&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Manoj Srivastava&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Feb 2003 20:10:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903088#M105428</guid>
      <dc:creator>MANOJ SRIVASTAVA</dc:creator>
      <dc:date>2003-02-12T20:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903089#M105429</link>
      <description>All above answers are right, except for one thing: you cannot rely on $SHELL :)&lt;BR /&gt;&lt;BR /&gt;I for one have a tcsh for logon (as all state, the last field in the /etc/passwd file), but I've set my $SHELL environment to /usr/bin/sh for all the obvious reasons.&lt;BR /&gt;&lt;BR /&gt;Fast way to check the last field of /etc/passwd&lt;BR /&gt;&lt;BR /&gt;# grep "^`logname`:" /etc/passwd | sed 's/.*://'&lt;BR /&gt;&lt;BR /&gt;do NOT rely on $LOGNAME, which is easy to overrule.&lt;BR /&gt;&lt;BR /&gt;If you want to know for the /effective/ userid:&lt;BR /&gt;&lt;BR /&gt;# perl -le'print+(getpwuid$&amp;gt;)[8]'&lt;BR /&gt;&lt;BR /&gt;And, heh, that's even shorter than grep/sed, *and* more reliable. Now you've got easyEnjoy, have FUN! H.Merijnctionality *and* fun in one blow :)&lt;BR /&gt;&lt;BR /&gt;and for the /real/ uid:&lt;BR /&gt;&lt;BR /&gt;# perl -le'print+(getpwuid$&amp;lt;)[8]'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
      <pubDate>Wed, 12 Feb 2003 20:12:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903089#M105429</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-02-12T20:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903090#M105430</link>
      <description>Good call on it not being reliable.  As far as I know, it will show your login shell, and never your current shell.&lt;BR /&gt;&lt;BR /&gt;Further, there is no way that I know of to get your "current" shell, only the login shell.&lt;BR /&gt;&lt;BR /&gt;One of them things I always wondered about.. figure it would be set somewhere, but.... maybe just me.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Shannon</description>
      <pubDate>Wed, 12 Feb 2003 20:36:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903090#M105430</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2003-02-12T20:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903091#M105431</link>
      <description>If you have "lsof", you could do the following-&lt;BR /&gt;&lt;BR /&gt;currshell=`lsof -p $$ | awk '$4=="txt"{print $9}'`&lt;BR /&gt;&lt;BR /&gt;This will give the path to the shell you are running (given by $$).&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Wed, 12 Feb 2003 20:59:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903091#M105431</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-02-12T20:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903092#M105432</link>
      <description>Okay guys, how about this which should work in any shell including csh.&lt;BR /&gt;&lt;BR /&gt;echo $$ | tail -1 | awk '{print $NF}'</description>
      <pubDate>Wed, 12 Feb 2003 21:10:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903092#M105432</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-02-12T21:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903093#M105433</link>
      <description>Hi,&lt;BR /&gt;Try this:&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;# ps |grep $$&lt;BR /&gt; 10956 pts/0     0:00 csh&lt;BR /&gt;# ksh&lt;BR /&gt;# ps |grep $$&lt;BR /&gt; 10963 pts/0     0:00 ksh&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Feb 2003 21:10:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903093#M105433</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-02-12T21:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: What command to determine the current shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903094#M105434</link>
      <description>Stupid me: I typed the correct command at my terminal but entered the wrong command on the Forums. It should be: ps -p $$ | tail -1 | awk '{print $NF}'&lt;BR /&gt;&lt;BR /&gt;Since ps -p $$ will only list the current process.&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Feb 2003 22:34:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-determine-the-current-shell/m-p/2903094#M105434</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-02-12T22:34:24Z</dc:date>
    </item>
  </channel>
</rss>

