adding output lines to my .cshrc breaks sftp and scp ...

Polytropon freebsd at edvax.de
Wed Jun 9 00:29:49 UTC 2010


On Tue, 8 Jun 2010 16:41:54 -0700 (PDT), Goh Sanda <x4500fbsd at yahoo.com> wrote:
> 
> 
> I added a few lines to the bottom of my standard FreeBSD .cshrc file:
> 
> echo ""
> w
> echo ""
> 
> Just to show me what is going on each time I log in.

Use ~/.login for command that should be executed after you log in.
The corresponding system-wide file is /etc/csh.login.



> I don't understand why .cshrc output is breaking non-interactive
> SSH file transfer.

Because .cshrc is read (and that's why "executed") every time a 
shell is requested.



> Is there a way to customize my .cshrc output while still retaining
> scp/sftp functionality ?

Simply use ~/.cshrc for settings, and ~/.login for "real" commands.



A better explaination can be found in "man csh", let me quote:

Startup and shutdown
    A  login  shell  begins  by  executing  commands  from the system files
    /etc/csh.cshrc and /etc/csh.login.   It  then  executes  commands  from
    files  in  the  user's  home  directory:  first  ~/.tcshrc  (+)  or, if
    ~/.tcshrc is not found, ~/.cshrc, then ~/.history (or the value of  the
    histfile shell variable), then ~/.login, and finally ~/.cshdirs (or the
    value of  the  dirsfile  shell  variable)  (+).   The  shell  may  read
    /etc/csh.login  before  instead  of  after /etc/csh.cshrc, and ~/.login
    before instead of after ~/.tcshrc or ~/.cshrc  and  ~/.history,  if  so
    compiled; see the version shell variable. (+)

    Non-login  shells read only /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc on
    startup.

    For examples of startup  files,  please  consult  http://tcshrc.source-
    forge.net.

    Commands  like  stty(1)  and  tset(1),  which need be run only once per
    login, usually go in one's ~/.login file.  Users who need  to  use  the
    same  set  of  files with both csh(1) and tcsh can have only a ~/.cshrc
    which checks for the existence of the tcsh shell variable (q.v.) before
    using  tcsh-specific  commands,  or  can  have  both  a  ~/.cshrc and a
    ~/.tcshrc which sources (see the builtin command) ~/.cshrc.   The  rest
    of  this manual uses `~/.tcshrc' to mean `~/.tcshrc or, if ~/.tcshrc is
    not found, ~/.cshrc'.






-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list