Skip to main content

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.

256 votes
3 answers
229k views

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's user avatar
  • 2,682
46 votes
2 answers
23k views

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 ...
iconoclast's user avatar
  • 9,258
2 votes
2 answers
2k views

Add an application to the command search path in csh

Recently, I have installed an application (gnuplot) under user directory (/home/usr/bin). I want to run the application whenever I type 'gnuplot' in any directory. What could I do? I tried to set the ...
user45857's user avatar
  • 145
15 votes
2 answers
18k views

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 ...
krb686's user avatar
  • 559
15 votes
4 answers
40k views

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 ...
gadgetmo's user avatar
  • 821
4 votes
2 answers
3k views

Event not found in sed call in csh script

I tried the code as given on delete text between curly brackets however I am facing this different error regarding event in sed. file contains: This is { {the multiline text} file } that wants { ...
JigarGandhi's user avatar
  • 4,990
3 votes
1 answer
16k views

Unwanted question mark appended to directory name when using mkdir

I am unsure why when I use mkdir -p $fbase an unwanted ? is appended to the name of the directory (27obs87St01Rec1?) . I have followed similar threads and ran cat -A filename to see if there are ...
B.Andrews's user avatar
3 votes
2 answers
254 views

Compatibility scripting: Save $? for use later

I would like to write a small part of a script that saves the error status, executes some other code, and sets the error status to the original error status. In Bash it looks like this: << some ...
Ole Tange's user avatar
  • 35.8k
3 votes
3 answers
6k views

Error "syntax error near unexpected token `('?"

What's in my terminal bash: settings64.csh: line 35: syntax error near unexpected token `(' bash: settings64.csh: line 35: `foreach i ( $xlnxInstLocList )' Portion of the script set xlnxInstLocList=...
caleb's user avatar
  • 41
0 votes
1 answer
7k views

CSH - How to check if input is NOT number

Need to apply it on csh. to check if the inputted $2 is not number nor the word "all" if ($#argv == 2 && ($2 != all && $2 != **any number**)) then echo "wrong parameter"
user68890's user avatar
-5 votes
1 answer
2k views

How to determine current users who are logged in using a specific domain? | UNIX [closed]

I want to know How to determine current users who are logged in using a specific domain? For example, here is the question. Please tell according to it using the grep command and use of wc. Question: ...
Zeus's user avatar
  • 111
26 votes
3 answers
3k views

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'...
LotoLo's user avatar
  • 616
7 votes
3 answers
501 views

'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 ...
Ole Tange's user avatar
  • 35.8k
5 votes
2 answers
2k views

Show every installed command-line shell?

How to show every installed command-line shell, (i.e. bash, zsh, etc.), with no duplicates, and nothing else, (i.e. no programs that aren't shells)? This code almost works on my Lubuntu system, (...
agc's user avatar
  • 7,243
5 votes
1 answer
2k views

Which is the real PATH variable

On my office computer it seems like I've have two PATH variables. $path : This is delimited by " " (Space) $PATH : This is delimited by ":" (Colon) Though when I update one, the other one ...
Kartik Anand's user avatar

15 30 50 per page