how to start tcsh automatically when it is not in /etc/shell?

how to start tcsh automatically when it is not in /etc/shell?

Post by Jianlin Cha » Tue, 18 Jan 1994 05:12:52



tcsh is not in our machines's /etc/shell, so I can't use tcsh as login shell. Is there
a way to start tcsh automatically, perhaps by placing a command in .cshrc? I tried by
placing 'exec tcsh' in .cshrc, but it doesn't work. I don't want to do so by placing
commands in .login, because I use 'rsh xterm' to enter this machine, not by logining,
thus .login is not read. Thanks very much.
 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by B.N.Blackmo » Tue, 18 Jan 1994 06:19:10


: tcsh is not in our machines's /etc/shell, so I can't use tcsh as
: login shell. Is there a way to start tcsh automatically, perhaps
: by placing a command in .cshrc? I tried by placing 'exec tcsh' in
: .cshrc, but it doesn't work. I don't want to do so by placing
: commands in .login, because I use 'rsh xterm' to enter this
: machine, not by logining, thus .login is not read. Thanks very
: much.

Its /etc/shells not /etc/shell (minor point)

The problem with executing tcsh from csh is that tcsh often likes
to read .cshrc and .login as well csh, so you can get the exec getting
exec'd again when tcsh starts.....

The fix for this is to test what shell you are running before you run the
exec line. In my ~/.login I have something like the following...

if (-x ~grs/bin/tcsh) then
    if ( $shell == /bin/csh ) then
        exec ~grs/bin/tcsh -l                                  
    endif
endif

If you wish to get xterm to use tcsh add the line...

setenv SHELL tcsh-path

to your X initalisation file (probably ~/.xsession, ~/.xinit or even
~/.environ). It is probably not a good idea to put the exec in your
.cshrc since this stops the use of csh all together, and you never know
when you might need it.

--
Brian Blackmore, The University of Kent at Canterbury, United Kingdom.
Beyond the shadow of a dream, who knows what lies.

 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Scott W. Adki » Tue, 18 Jan 1994 06:15:31



>tcsh is not in our machines's /etc/shell, so I can't use tcsh as login shell. Is there
>a way to start tcsh automatically, perhaps by placing a command in .cshrc? I tried by
>placing 'exec tcsh' in .cshrc, but it doesn't work. I don't want to do so by placing
>commands in .login, because I use 'rsh xterm' to enter this machine, not by logining,
>thus .login is not read. Thanks very much.

Why doesn't putting 'exec tcsh' in your .cshrc file work?  Do you get any kind of
error messages?  Are you using a csh to begin with?

Ok, here is how I do it:

  1) I am running a csh as the default login shell (specified in /etc/shells).  This
     means that I will place my 'exec tcsh' in the .cshrc file.  If you are running
     in a bourne like shell, then you will need to modify your .profile file instead.

  2) According to Unix Power Tools (O'Rielly & Associates), you should create a hard
     link or symbolic link in your home directory to the tcsh that you want to use.
     When you name the symbolic link, make it with a dash in front of it...

        cd $HOME
        ln $HOME/bin/tcsh -tcsh

     For whatever the reason, this is suppose to make your tcsh look like a real
     login shell.  All I can tell is that it makes the process table look like you
     are running a real login shell.

  3) Modify your .cshrc file as follows:

        if (! $?prompt) goto cshrc_end
        if (! $?tcsh) exec -tcsh

          [ the rest of your .cshrc file goes here ]

        cshrc_end:

  4) You are done!  Hint: Don't log out of your account until you have tried it
     by logging in from another account!  If something goes wrong and this does
     not work, then you will want to be able to undo it!

Good luck!
Scott
--



 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Casper H.S. D » Tue, 18 Jan 1994 08:25:44



Quote:>  2) According to Unix Power Tools (O'Rielly & Associates), you should create a hard
>     link or symbolic link in your home directory to the tcsh that you want to use.
>     When you name the symbolic link, make it with a dash in front of it...
>    cd $HOME
>    ln $HOME/bin/tcsh -tcsh

Actually, tcsh has a -l option for exactly this purpose:
        exec tcsh -l.

Make sure you only do this in an interactive shell:

        if ( ! $?tcsh && $?prompt) exec tcsh -l

Casper

 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Jeremy Mathe » Tue, 18 Jan 1994 08:54:08


(Always remember - this text has been reformatted for your
protection...)

Quote:>tcsh is not in our machines's /etc/shell, so I can't use tcsh as login
>shell. Is there a way to start tcsh automatically, perhaps by placing
>a command in .cshrc? I tried by placing 'exec tcsh' in .cshrc, but it
>doesn't work. I don't want to do so by placing commands in .login,
>because I use 'rsh xterm' to enter this machine, not by logining, thus
>.login is not read. Thanks very much.

I haven't tested this, but it should work.  Put the following line at
the beginning of your .cshrc:

if ($?tcsh == 0) exec tcsh

************************************************************************
Past performance is no guarantee of future results.


          hundreds, if not thousands, of dollars, every time he posts -
************************************************************************
rwvpf wpnrrj ibf ijrfer

 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Stefan Monni » Wed, 19 Jan 1994 10:23:15




> tcsh is not in our machines's /etc/shell, so I can't use tcsh as
> login shell. Is there a way to start tcsh automatically, perhaps by
> placing a command in .cshrc? I tried by placing 'exec tcsh' in .cshrc,
> but it doesn't work. I don't want to do so by placing commands in
> .login, because I use 'rsh xterm' to enter this machine, not by
> logining, thus .login is not read. Thanks very much.    

Others have already mentioned a few ways, but I'd just warn you of a
potential problem.

when running rsh, the remote shell gets the command it has to exec on
its command line

truc> rsh dull.machine echo hello

might start your remote csh shell like that:

Quote:>>>> csh -c 'echo hello'

In your .cshrc, you just can't get the 'echo hello': it's not in the
$argv and it's not in the stdin. And if you exec anything (like tcsh
for instance), that something won't know about the command. So you
just can't get it executed. You have to stick to your old csh.

If you meant 'rlogin' instead of 'rsh' (rsh with no argument is
actually an rlogin), than that isn't a problem.

        Stefan

--

-----------------------------------------------------
-- On the average, people seem to be acting normal --
-----------------------------------------------------

 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Stephen Rieh » Wed, 19 Jan 1994 18:46:20



>Others have already mentioned a few ways, but I'd just warn you of a
>potential problem.
>when running rsh, the remote shell gets the command it has to exec on
>its command line
>>>>> csh -c 'echo hello'
>In your .cshrc, you just can't get the 'echo hello': it's not in the
>$argv and it's not in the stdin. And if you exec anything (like tcsh
>for instance), that something won't know about the command. So you
>just can't get it executed. You have to stick to your old csh.

what you say is true, partly. This is exactly why you check for the
existence of $prompt before you start firing up some secondary shell.
$prompt will only be set in interactive shells, running a rsh (resh or
remsh, depending on your flavour) starts an non-interactive shell, and
so you let the shell run as normal.

I personally use:

if ( ! $?prompt ) then
    # set up a simple path and get outa here!
    setenv ARCH `/bin/arch`
    set path=( /bin /usr/bin /etc /usr/local/bin $path )
    set path=( . /home/ln_smr/{scr,bin.$ARCH} /usr/bin/X11 $path )
    exit 0
else
    # get the right shell
    # SHELL should be set to tcsh, but then a lot of shell checks would fail!
    if ( ! $?NO_TCSH && ! $?tcsh && -x ~ln_smr/bin.`/bin/arch`/tcsh ) then
        echo Starting tcsh...
        setenv SHELL /bin/csh
        exec ~ln_smr/bin.`/bin/arch`/tcsh -l
        exit 0
    endif
endif
# set up aliases etc.

which works just fine (you'll have to change the paths a little
probably :-) )

Steve

 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Christos Zoul » Thu, 20 Jan 1994 15:33:31



In your .login you can add:

if ( ! $?tcsh ) then
        exec tcsh -l
endif

the -l option, tells tcsh to behave like a login shell.

christos

 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Charles QC Ch » Sat, 22 Jan 1994 07:53:44





> In your .login you can add:
> if ( ! $?tcsh ) then
>    exec tcsh -l
> endif
> the -l option, tells tcsh to behave like a login shell.
> christos

Wouldn't that make tcsh source your .login file again?
That may not be necessary, especially when some system, like ours,
set up in such a way that the .login file will read the news of the
day. Thiss can take quite an amount of time.

Please correct me if I am wrong.
Charles

--
===============================================================

     _/_/_/  _/                        _/
    _/      _/                        _/
   _/      _/_/_/  _/_/_/    _/_/_/  _/    _/_/_/    _/_/
  _/      _/  _/  _/  _/    _/      _/    _/_/     _/ _/  
 _/_/_/  _/  _/  _/_/_/_/  _/      _/_/  _/_/_/  _/_/_/

Charles QC Chan

Undergraduate Computer Engineering
University of Michigan, Ann Arbor

 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Erwan Dav » Sat, 22 Jan 1994 18:28:09







>> In your .login you can add:

>> if ( ! $?tcsh ) then
>>        exec tcsh -l
>> endif

>> the -l option, tells tcsh to behave like a login shell.

>Wouldn't that make tcsh source your .login file again?
>That may not be necessary, especially when some system, like ours,
>set up in such a way that the .login file will read the news of the
>day. Thiss can take quite an amount of time.

        Yes it would, but if you change your "login shell" to /bin/sh
(via chsh), and put exec tcsh -l in your .profile, it will be read
only once.

        Erwan

--

45 rue d'Ulm |                          | je m'en rapproche de plus en plus"

FRANCE       |                          |   Julos Beaucarne

 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Scott W. Adki » Tue, 25 Jan 1994 22:17:08








>>> In your .login you can add:

>>> if ( ! $?tcsh ) then
>>>    exec tcsh -l
>>> endif

>>> the -l option, tells tcsh to behave like a login shell.

First off, the version of tcsh that I have compiled says that the -l option is
supported (even in the command line usage), but when I use it, it says unknown
option... go figure...

Quote:>>Wouldn't that make tcsh source your .login file again?
>>That may not be necessary, especially when some system, like ours,
>>set up in such a way that the .login file will read the news of the
>>day. Thiss can take quite an amount of time.

>    Yes it would, but if you change your "login shell" to /bin/sh
>(via chsh), and put exec tcsh -l in your .profile, it will be read
>only once.

I don't understand why the .login file is being sourced again... Isn't the
.cshrc file sourced *first* and then the .login?  If this is the case, then
the exec is placed in the .cshrc file.  Once the .cshrc file is sourced the
second time (this time under the tcsh), then it will source the .login file
(for the first and last time) and be done...  So, changing your shell is not
necessary...  (By the way, when I tinkered around with the above, I actually
placed echo statements in both the .cshrc and .login files so that I knew
things were working like they were supposed to... so I do know that .login is
sourced only once...

Scott
--



 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Chris Davi » Thu, 27 Jan 1994 22:39:01



: If this is the case, then
: the exec is placed in the .cshrc file.

But if you place the exec in the .cshrc it will be called every time
you start a subshell, too.

: (By the way, when I tinkered around with the above, I actually
: placed echo statements in both the .cshrc and .login files so that I knew
: things were working like they were supposed to... so I do know that .login is
: sourced only once...

Correct.  ".cshrc" is sourced for every (new) instance of *csh.  The
".login" is only sourced as part of the login process (indeed, as you
point out, after the .cshrc).

Chris
--
          VISIONWARE LTD, 57 Cardigan Lane, LEEDS LS4 2LE, England

-------- "Visionware:   The home of DOS/SQL/UNIX/X/VMS integration" --------

 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by matth.. » Fri, 28 Jan 1994 03:21:02


this is the way i did it in an accout of mine:
here are the contents of my .cshrc
<------------------------------------------------
if (! $?tcsh) then
        setenv SHELL "bin/tcsh"
        exec tcsh
endif
<------------------------------------------------
my .tcshrc contains everything you might expect to be in a .cshrc or
.tcshrc file, plus everything that should be in my .login file.
i have no .login file.

i also have a file, .hushlogin (contents irrelevent) that give me a
'quiet' login. (no motd)

this set up has worked for me for quite a while, hope it helps.

--
matthew
^^^^^^^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 
 
 

how to start tcsh automatically when it is not in /etc/shell?

Post by Jeremy Mathe » Sat, 29 Jan 1994 04:59:24



Quote:>...
>I don't understand why the .login file is being sourced again... Isn't the
>.cshrc file sourced *first* and then the .login?  If this is the case, then

Actually, this is controlled by a tcsh compile time constant.  I believe
the default is the normal order (.[t]cshrc first, then .login [if login
shell]), but it can be tweaked by the person who sets up tcsh on a given
system.

************************************************************************
The Zapruder film was a*film.


          hundreds, if not thousands, of dollars, every time he posts -
************************************************************************
rwvpf wpnrrj ibf ijrfer

 
 
 

1. Although XFS is in /etc/rc.d/rc3.d,rc5.d, it does not start automatically

Hi,
    I am using Redhat 6.1 with xfs version 3.3.5-3. XFS will not
start automatically, although in /etc/rc.d/rc3.d and rc5.d it
is listed as S90xfs. I can start it manually, nevertheless.
How to get it to start automatically again and why not working now?

                                                            Thanks

Mike

2. Distributed Modem Pool Software version 1.4

3. How to autostart tcsh when it is not in /etc/shells?

4. DNS Resolution Issues

5. Am at sea with so many shells -- tcsh, ksh, zsh or bash?

6. elm2.4 & linux/slack pl12

7. apm does not start automatically

8. illegal instruction in shared library

9. /etc/shells - getusershell - /bin/tcsh ????

10. How can named be started automatically at boot time not by manual?

11. Making KDE not start automatically

12. lilo not automatically start

13. Switching to Tcsh from Csh, no /etc/shell