2

What is the difference between: C Shell variants and Bourne Shell variants?

I must install a scientific software, during the installation I must write

./configure >& config.out & ## C Shell variants

./configure > config.out 2>&1 & ## Bourne Shell variants

just to have idea about this.

heemayl
  • 91,753
EsH2O
  • 23

1 Answers1

3

C shell (e.g. csh, tcsh) and Bourne shell (e.g. sh, bash) are two shell families. These two have differences in syntaxes and implementation of various operations.

The examples you have shown are how these two family handle redirection of file descriptors. Both commands are redirecting STDERR (file descriptor 2) to STDOUT (file descriptor 1), sending STDOUT to the file config.out, so all the STDOUT and STDERR are being redirected to the file. And also sending the command to background by & at the end.

Historically, C shell uses >& to redirect both STDOUT and STDERR at once while Bourne shell uses two redirections to do so, at first sending STDOUT to the file and then sending STDERR to the place STDOUT is going i.e. the file.

Note that, the above discussion is true for all C shell an Bourne shell family of shells for the sake of portability. But now a days many things have changed and these type of things are modified for the sake of efficiency in newer implementations of various shells e.g in bash (or zsh/ksh) which has inherited from Bourne shell, you can do the above with &>:

./configure &> config.out & 

As you can see it is actually the reverse of csh syntax, >&.

heemayl
  • 91,753
  • Really thank you I have now some global view, before I am new user with Ubuntu 14.04, but I would like to know more about config.out and STDOUT, STDERR as well. – EsH2O Jul 25 '16 at 14:32