Pages

mercredi 16 mars 2011

csh and bash

In my Mac computer the shell is bash, and in the server that I use the shell is csh. I noticed some differences here.

1) setenv in csh and export in bash
2) setenv name value; export name=value

3) The C shell, like the Korn shell, uses one file to set up the login environment and a different file to set up environments for every subsequent C shell. In C shell, .login is the file read only at login, and .cshrc is the file read each time a csh is started.

in the bash, .bash_profile : personal profile that is processed every time you login
.bashrc : setup file processed every time you open a non-login shell

4) While both the Bourne shell and the Korn shell use Bourne shell startup scripts, the C shell uses C-shell startup scripts. C-shell scripts do not start with a ``:'' because they are intended for use with C shells, not Bourne shells.

5) in bash, file=$(ls);echo $file. THis works in bash. But in csh, one has to change:
set file=`ls`;echo $file.

6) c shell does not support function !! while bash does !!

7) other syntex differences: such as 'if....fi' in bash and 'if....endif' in c shell

8) the 'date' command in bash and csh has a lot of differences !

For example of cshrc and .login, see the link http://osr507doc.sco.com/en/OSUserG/_The_C-shell_login_and_cshrc.html

Aucun commentaire:

Enregistrer un commentaire