Questions tagged [csh]

The C shell (csh), once one of the two major Unix shells with the Bourne shell. Csh had more advanced interactive feature but has been surpassed by modern Bourne-style shells such as zsh and bash.

The C shell (csh) is one of the two major historical command line processors on Unix systems, the other one being the Bourne shell (sh). A modified Bourne shell went on to be standardized by POSIX, while use of the C shell has declined.

Csh and its derivative were widely considered to have superior interactive features but inferior programming features. Newer shells such as and have since then acquired and surpassed tcsh's interactive features such as advanced command line edition and programmable completion, while the csh family has seen little evolution since the late 1990s.

280 questions
253
votes
3 answers

Difference between 2>&-, 2>/dev/null, |&, &>/dev/null and >/dev/null 2>&1

Just looking for the difference between 2>&- 2>/dev/null |& &>/dev/null >/dev/null 2>&1 and their portability with non-Bourne shells like tcsh, mksh, etc.
Det
  • 2,652
  • 3
  • 13
  • 7
43
votes
2 answers

Are there problems with hyphens in functions, aliases, and executables?

In my testing (in Bash and Z Shell), I saw no problems with defining functions or aliases or executable shell scripts which have hyphens in the name, but I'm not confident that this will be okay in all shells and in all use cases. The reason I would…
iconoclast
  • 9,057
  • 12
  • 56
  • 95
26
votes
3 answers

How does a shell know home(s)?

Each shell has an environment variable $HOME set (ex: /Users/lotolo). If I'm under csh I can unsetenv HOME and still if I do cd I'll be in my home. I've tested this also on bash (unset HOME) and it's the same behavior. So how does the shell know…
LotoLo
  • 596
  • 1
  • 8
  • 18
16
votes
3 answers

Is it possible to redefine the tilde ('~', home directory)?

Is it possible to redefine the home directory? e.g. to /ext1/username instead of /home/username, i.e. expanding the ~ to another directory (as opposed to changing the actual home directory where users' home files are located). (This question is…
Andrew Cheong
  • 673
  • 2
  • 9
  • 23
15
votes
4 answers

stderr redirection not working in csh

I run the following command: pkg_add emacs-23.4,2.tbz 2> output.log The output still displays in the terminal. When I press ↑, I get pkg_add emacs-23.4,2.tbz 2 > output.log with a space before the 2. I did not originally put this. I try pkg_add…
gadgetmo
  • 831
  • 4
  • 14
  • 21
14
votes
2 answers

Is it possible to send a HEREDOC over ssh to a remote host from inside a script running locally?

I essentially want to run a script on machine A which will SSH into machine B, execute commands on B, and return the output to machine A. So I am creating a csh script to do this, hopefully, if it's possible. For instance, this solution from this…
krb686
  • 539
  • 1
  • 4
  • 16
11
votes
4 answers

Convert value from scientific notation to decimal in shell?

How to convert value from scientific notation to decimal in shell? (preferred C shell) Also I'd want to convert it from e-12 to e-9 and then shell 42.53e-12 to 0.04253. I have to do this for a list.
cHiRaG
  • 133
  • 1
  • 1
  • 4
8
votes
6 answers

dircolors "missing second token"

I'd like to customize the colors of ls and as far as I understand the way to go is with dircolors. I did: dircolors > ~/.dircolors Immediately after this I launch a terminal and get this error: dircolors: /home/frank/.dircolors:1: invalid line; …
user11498
  • 2,421
  • 4
  • 22
  • 25
7
votes
2 answers

How to debug csh scripts?

My lab uses csh scripts to run jobs. It is usually difficult for me to debug a shell script, so I'm wondering if there is a csh debugger I can use. I know there are some flags like -x or -v that can help, but because the script is kind of long, it…
Cassie
  • 221
  • 1
  • 3
  • 6
7
votes
3 answers

'switch' based on shell

I would like to source (i.e. not call) a script from any shell (bash/csh are the primary targets, but fish, zsh, ksh, and rc would also be interesting). I would like if the script can be a single file - i.e. not a file for each shell dialect. Can I…
Ole Tange
  • 33,591
  • 31
  • 102
  • 198
6
votes
6 answers

How do I specify arguments to return all dot files, but not . and ..?

Normally dot files are not included for wildcard expansion: % echo * Applications Desktop Documents Downloads Library Movies Music Pictures Public bin If I explicitly ask for dot files, I get them: % echo * .* Applications Desktop Documents…
Mark Adler
  • 1,955
  • 4
  • 14
  • 15
6
votes
1 answer

Is there a csh to bash script translator?

Programming in C shell is considered harmful by some people, but csh scripts are continued to be written by some hardcore csh fans. Is there a free/open source converter to translate csh script into bash? If such a program does not exist, is it…
Gowtham
  • 2,003
  • 2
  • 15
  • 14
6
votes
2 answers

Can a home directory have both .cshrc and .bashrc files?

Or are they both not allowed at the same time?
InquilineKea
  • 6,152
  • 12
  • 43
  • 42
6
votes
2 answers

How to enable double tab autocompletion list in csh?

I've worked in Linux before where when I press tab it autocompletes until it becomes ambiguous. If I pressed tab twice at that point it would give me a list of all possible completions. My current Linux environment does not have the second…
greggmi
  • 163
  • 1
  • 7
5
votes
1 answer

What's special about "!xxx%s%s%s%s%s%s%s%s"?

I was linked to The Unix-Haters Handbook and stumbled on (page 149): Subject: Relevant Unix bug October 11, 1991 Fellow W4115x students— While we’re on the subject of activation records, argument passing, and calling conventions, did you know that…
Alexey Romanov
  • 635
  • 1
  • 7
  • 14
1
2 3
18 19