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
-2
votes
1 answer

How to call a Perl program from a csh script

I have this simple code to execute, but have failed. a.csh #! /bin/csh -f `perl a.pl` a.pl #use perl eval 'exec perl -w -S $0 ${1+"$@"}' if 0; use Cwd; print "here.\n"; When I run a.csh, it reports an error as below. here: Command not…
Rocky Zheng
  • 31
  • 1
  • 10
-2
votes
1 answer

Editing second match pattern after first match pattern with sed/awk

I have the following file with the format shown below. how do I do a first pattern match on cell = XX, and edit a specific string after matching the cell=XX. File.txt {cell DFT_AXA {naming A_1 A_2 A_3 A_4 A_5 B_1 B_2 B_3 C_1 C_2 C_3 D_1 D_2 D_3 D_4…
Ginny
  • 7
  • 5
-2
votes
1 answer

~/.setprompt: No such file or directory

trying to change directory in csh script. But i am getting following error : ~/.setprompt: No such file or directory permission of above file is like that : -rwxrwxrwx 1 vgangwar 46 Oct 5 2015 /home/vgangwar/.setprompt
Undefined Behaviour
  • 729
  • 2
  • 8
  • 27
-2
votes
3 answers

set: Variable name must begin with a letter

Its my code, how to set k as 17 less than j. It gives the error: set: Variable name must begin with a letter. #! /bin/csh -ef set j = 18 while ($j <= 40) set k = $j-17 set i = 18 while ($i <= 40) set l = $i - 17 …
user7345509
  • 1
  • 1
  • 1
  • 2
-2
votes
3 answers

While loop in shell script not working in the linux bash shell

Am kind of newbie in writing shell scripts in linux. Its a csh script but am running it in the bash shell that why I used #!/bin/bash instead of #!/bin/csh. 1 #!/bin/bash 2 set i = 1 3 echo it starts 4 5 while ($i <= 5) 6 echo i…
Young Emil
  • 2,220
  • 2
  • 26
  • 37
-2
votes
3 answers

How to write shell script,to automate file conversion?

I have 30 files(ascii),which I want convert to binary.Linux command line(FORTRAN 77 CODE) that has been compiled ./rec_binary Relevant part of the code character*72 ifname,ofname c write(*, fmt="(/'Enter input file name')") …
Richard Rublev
  • 7,718
  • 16
  • 77
  • 121
-2
votes
2 answers

Convert .cshrc to .bashrc

I am new to Linux and I am trying to compile some code that needs environment variables set first. The script is in cshrc, but whenever I try to run that code I get "if: badly formed number" errors. I want to run it in bash instead. Is there an…
Blade3
  • 4,140
  • 13
  • 41
  • 57
-2
votes
2 answers

passing variable to this particular sed command

I am first searching for a key word and once that key word is found in a file from that particular line i am supposed delete till end of file. #! /bin/csh -f set sa = `grep -n -m 1 "^Pattern" file` set s = `echo "$sa" | cut -d':' -f1` set m =…
user2508758
  • 91
  • 1
  • 2
  • 8
-2
votes
1 answer

how to stop .cshrc file from auto loading?

When we open a new konsole or xterm .cshrc file automatically get sourced. But I dont wnat it to get sourced. So how can I make a .cshrc not get sourced on opening up a new shell or konsole. It should only be sourced if following command is…
XYZ_Linux
  • 3,247
  • 5
  • 31
  • 34
-2
votes
2 answers

copy files beginning with a certain letter

edit: Thanks guys - so if I do "ls J*", why doesn't that list all the files beginning with J? I just want to copy directories beginning with the letter J into another folder in my (cshell) terminal window? It must be one quick line surely, but I…
user1551817
  • 6,693
  • 22
  • 72
  • 109
-3
votes
1 answer

join random number of lines untill close brace match in unix file

Need to join random number of lines untill close brac match and substitute with one space in unix file . There can be multiple occurence like this in file . One liner awk , sed , perl solution will be more helpful. Eg : .... abc_mod #( .h_res(3),…
-3
votes
1 answer

#!/bin/csh Cshell check find result if else

Goal: Checking find result, if empty echo something, if not echo find result #!/bin/csh set mtime = 0; echo "Title" >> $outputfile set text=`find start*middle*.txt -mtime $mtime -ls` echo "$text" >> $outputfile I have tried the following…
DavidDunham
  • 1,245
  • 1
  • 22
  • 44
-3
votes
1 answer

Remove newline from awk

I use awk for print file line by line. I need to remove every newline character using awk. My code while($lines>0) echo -n "Output: '" awk NR==$i output.txt echo "'" @ i++ @ lines-- end Output must be like this: Output:…
Jakub Rosina
  • 59
  • 2
  • 7
-3
votes
4 answers

How to modify mutiple lines pattern?

I have in a file sth like: .... sth Q-[N1] your name? A1-My first name is Joe A2-My Last name is Jim sth sth .... .... sth Q-[N2] your name? A1-My first name is Jack A2-My Last name is JUNE sth sth .... I wanted to add "last name" at the end of…
Nukas
  • 3
  • 1
-4
votes
1 answer

Check if command exists for setting alias in tcshrc

I check if a command exists in Bourne shell as below: if [ "$(command -v emacs)" 2>&1 ]; then alias emacs='emacs -nw'; fi I am aware that tcsh is not the best shell for shell scripting but how do I implement the above scenario in tcshrc ?
1 2 3
78
79