Thread View: comp.unix.shell
4 messages
4 total messages
Started by John Ruckstuhl
Wed, 28 Nov 1990 04:44
How does one learn arg0 in csh
Author: John Ruckstuhl
Date: Wed, 28 Nov 1990 04:44
Date: Wed, 28 Nov 1990 04:44
21 lines
1234 bytes
1234 bytes
I'd like to test if a csh is a login shell in ~/.cshrc. In a Bourne
shell, I can look at $0 and see "-sh" , but in csh, $0 substitutes "the
name of the file from which command input is being read" which is an
error in an interactive csh.
"login" documentation says: Argument 0 of the command interpreter is the
name of the command interpreter with a leading dash ('-') prepended.
I am aware that if the csh !is! the login shell, then ~/.login will be
sourced.
I am using the csh shipped with SunOS 4.1 on SPARCStation1+'s.
"what `which csh`" shows a lot of revision info -- perhaps this line
identifies the version sufficiently:
sh.c 1.22 89/05/22 SMI; from UCB 5.3 3/29/86
Thank you for your comments,
ruck
--
John R Ruckstuhl, Jr
University of Florida ruck@cis.ufl.edu, uflorida!ruck
Re: How does one learn arg0 in csh
Author: John Adams
Date: Thu, 29 Nov 1990 22:13
Date: Thu, 29 Nov 1990 22:13
6 lines
522 bytes
522 bytes
The c-shell "prompt" varaible will be set if you have a login shell. You can test by: if ( $?prompt ) John Adams
Re: How does one learn arg0 in csh
Author: John Ruckstuhl
Date: Sun, 02 Dec 1990 17:41
Date: Sun, 02 Dec 1990 17:41
23 lines
1369 bytes
1369 bytes
me> I'd like to test if a csh is a login shell in ~/.cshrc. In a Bourne
me> shell, I can look at $0 and see "-sh" , but in csh, $0 substitutes "the
me> name of the file from which command input is being read" which is an
me> error in an interactive csh.
me> "login" documentation says: Argument 0 of the command interpreter is the
me> name of the command interpreter with a leading dash ('-') prepended.
me> I am aware that if the csh !is! the login shell, then ~/.login will be
me> sourced.
j_adams@hpfcbig.SDE.HP.COM (John Adams) writes:
>The c-shell "prompt" varaible will be set if you have a login shell. You
>can test by:
> if ( $?prompt )
Insufficient, I think. prompt will also be set if one is in a subshell
to the login shell, rather than in a login shell.
Thank you for your comments,
ruck
--
John R Ruckstuhl, Jr
University of Florida ruck@cis.ufl.edu, uflorida!ruck
Re: How does one learn arg0 in csh
Author: Roger Rohrbach
Date: Mon, 03 Dec 1990 22:13
Date: Mon, 03 Dec 1990 22:13
16 lines
1013 bytes
1013 bytes
ruck@reef.cis.ufl.edu (John Ruckstuhl) writes:
> I'd like to test if a csh is a login shell in ~/.cshrc.
(This is really what your "Subject:" line should be.) In an interactive
C shell, the "prompt" variable will be set. This can be tested with
if ($?prompt) then
...
endif
--
Roger Rohrbach sun!wrs!roger roger@wrs.com
- Eddie sez: ----------------------------------------------- (c) 1986, 1990 -.
| {o >o |
| \ -) "Two men need one money, but one money needs no man." |
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads