Date: Wed, 9 Jun 2010 02:29:45 +0200 From: Polytropon <freebsd@edvax.de> To: Goh Sanda <x4500fbsd@yahoo.com> Cc: freebsd-questions@freebsd.org Subject: Re: adding output lines to my .cshrc breaks sftp and scp ... Message-ID: <20100609022945.ffe09ab5.freebsd@edvax.de> In-Reply-To: <101691.53333.qm@web120207.mail.ne1.yahoo.com> References: <101691.53333.qm@web120207.mail.ne1.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 8 Jun 2010 16:41:54 -0700 (PDT), Goh Sanda <x4500fbsd@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, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100609022945.ffe09ab5.freebsd>
