Questions tagged [csh]

csh, or the C shell, is a command interpreter with a syntax reminiscent of the C programming language.

Quoted from the Solaris csh man page:

csh, the C shell, is a command interpreter with a syntax reminiscent of the C language. It provides a number of convenient features for interactive use that are not available with the Bourne shell, including filename completion, command aliasing, history substitution, job control, and a number of built-in commands. As with the Bourne shell, the C shell provides variable, command and filename substitution.

csh first appeared in 2BSD, and was originally created by Bill Joy. While Bourne shells are more popular, csh-style shells are still fairly popular especially in the BSD community & academia.

is an an enhanced version of csh, almost all versions of csh encountered nowadays are actually tcsh.

Programming in csh is a controversial topic. For one viewpoint, see this article.

1173 questions
0
votes
1 answer

Converting from switch-case to if-then statement

I am trying validate input using cshell but am having trouble with the exact syntax. I know what you can use switch case structures like so: switch ( $input ) case [0-9]: echo Input is good But is there a way to do this with if-then…
MrDiggles
  • 748
  • 1
  • 5
  • 19
0
votes
2 answers

csh script syntax

I am new to csh script this is the first time i am writing any script: Here is code: #!/bin/csh #arg1 path #arg2 condition #arg3 number of files #arg4-argN name of files set i=0 while ( $i < $3 ) if ($2 == 0) then cp…
Abhi
  • 192
  • 1
  • 4
  • 17
0
votes
1 answer

csh error "set: No match."

So I am writing a calculator c shell script that reads numbers in from a file, and the shell returns the answer. For example, in the numbers text file, I would have: 1129 3100 + and my csh file, once run, would return Input from line 1 : 1129 3100…
user2060214
  • 423
  • 1
  • 6
  • 11
0
votes
1 answer

Read user input (which should be a linux command) and execute

I wish to write a simple csh script which loops through all computers in a network and executes a command that is input at the command line echo -n "Please enter command you would like executed on all computers > \n " set command = "$<" say the user…
moadeep
  • 3,988
  • 10
  • 45
  • 72
0
votes
3 answers

Translating csh switch to perl

I am currently translating some scripts from csh to perl. I have come across one script which has the following switch control #And now some control set get_command = h set finish = 0 while (1) switch ($get_command) case "h": case…
moadeep
  • 3,988
  • 10
  • 45
  • 72
0
votes
1 answer

Finding regular expression in list of files

I have several header files in a directory with the format imageN.hd where N is some integer. Only one of these header files contains the text 'trans'. What I am trying to do is find which image contains this expression using csh (I need to use csh…
moadeep
  • 3,988
  • 10
  • 45
  • 72
0
votes
1 answer

Using the csh tail by exception

Please can you help me, I am trying to strip some data from the end of a file, say file.oot. I would like to use tail command, returning everything except the last n lines. I would like to limit this to a single line command as part of a csh…
Thorsley
  • 1,003
  • 2
  • 9
  • 11
0
votes
1 answer

Tracing how my path is being set

Is there a way (in UNIX) to trace how my $PATH is set? I have an entry in my path that I don't want, but I just can't find the source to remove it for good. I am running Solaris 10 and CSH.
Zubizaretta
  • 157
  • 1
  • 9
0
votes
1 answer

tcshrc setting path getting error

im trying to set the environment path to run pintos command like this in my home floder under ubuntu set path = ($path /home/pintos/src/utils) and I type terminal command try to compile this :~$ source .tcshrc but it seems get error like this …
Yank
  • 718
  • 6
  • 17
0
votes
1 answer

changing csh regexp match code to tcl

I need to change the following piece of code in shell to tcl. Please help. if (` expr $_f : proj_lp_ ` == 8) then I need the tcl equivalent of the condition inside the if condition. Thanks!
0
votes
2 answers

Is it possible to run a script which loops through hosts with rsh/ssh

I have tried to run following csh script which ssh to all computers on our network with the purpose of yum installing software passed as arguments. However, the script fails to continue once I have rsh to another host. Is there a way around this…
moadeep
  • 3,988
  • 10
  • 45
  • 72
0
votes
1 answer

how to extract string before "/>" from XML using csh?

I am trying to extract all text which is present before the first occurrence of sign "/>" using csh script. I tried the following code set product3 = echo "$product1" | sed 's/\/>$//' bt the output I am getting is the string exist before last…
XYZ_Linux
  • 3,247
  • 5
  • 31
  • 34
0
votes
3 answers

Error converting a bash function to a csh alias

I am writing a csh alias so that I can use the following bash function in my csh : function up( ) { LIMIT=$1 P=$PWD for ((i=1; i <= LIMIT; i++)) do P=$P/.. done cd $P export MPWD=$P } (I stole the above bash…
Chani
  • 5,055
  • 15
  • 57
  • 92
0
votes
3 answers

Simple sed substitution

I have a text file with a list of files with the structure ABC123456A or ABC123456AA. What I would like to do is check whether the files ABC123456ZZP also exists. i.e I want to substitute the letter(s) after ABC123456 with ZZP Can I do this using…
moadeep
  • 3,988
  • 10
  • 45
  • 72
0
votes
1 answer

how to find directories without access permissions ?

Possible Duplicate: Using `find -perm` to find when a permission is not set I have a list of directories in which some do not have access permissions. How can I create an array so that it contains only accessible directories using csh. My code…
XYZ_Linux
  • 3,247
  • 5
  • 31
  • 34