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

CSH input- to accept wilcard with getOptions without using \ -Perl

I am working with perl in csh. Now I am using get options thing. I want to use as myperl -f temp1*.txt But it won't go into code and give me error 'No match.' Currently I below things are working.. myperl -f temp1\*.txt and myperl -f…
karate_kid
  • 145
  • 1
  • 5
  • 14
0
votes
1 answer

Escaping variables in path names using csh

I am trying to create paths using variables as follows: set var=foo set path="/home/user/prefix_$var_suffix/bar" What is the proper way to embed the variable so that it doesn't keep reading past the _. As a bonus, is there a syntax that will work…
Stuart
  • 1,733
  • 4
  • 21
  • 34
0
votes
1 answer

Remove symbol in shell

I'm new to shell scripting, right now using csh and let's say I have a line in my configuration file like this: 127.0.0.1:2222 127.0.0.2:3333 127.0.0.3:4444 All I want is to parse it for two variables in array : 2222 3333 4444 And another one…
Ebbcom
  • 1
0
votes
1 answer

How to use CSH script to generate a hundred of files from a template file with matched filenames and contents?

I am using Linux, I have a template.in file as follows: xxxxFileNamexxxx xxxxxxxxxFileName I want to generate a hundred of files with the filenames and content as follows: For R1.in xxxx1xxxx xxxxxxxxx1 For R2.in xxxx2xxxx xxxxxxxxx2 For…
Peter
  • 1
0
votes
0 answers

csh script exits on its own

I have a csh script (I have to use csh, I can't use bash) called new_script which calls another script called soak_script 12 times. The soak_script sleeps for 12 hrs and then does some tests. My problem is that my original script (new_script)…
Rahul
  • 371
  • 1
  • 2
  • 12
0
votes
0 answers

Using if statements in CShell

can some one please explain to me how to do multiple if statements and nested if statements in an awk line? I am using the awk command in a CShell program. My code: awk '{split ($2,b,""); if (b[1-] == 1)…
Danny
  • 117
  • 1
  • 7
0
votes
1 answer

evaluating environment variable from file in csh

I have a config file that contains the following line: pre_args='$REGION','xyz',3 Using perl from within a csh script I can evaluate environment variable $REGION like so: set pre_args = `grep -v '^#' $config_file | grep pre_args | cut -f 2 -d = |…
richard
  • 75
  • 1
  • 5
0
votes
1 answer

Using components from multiple environments (windows , & linux) in sync

I was supplied two components by different parties; one that works on windows 32 bit and another that works in linux 64 bit. For my program I need to take the output files of the windows component and put them as an input to the linux component. I…
SrSbSd
  • 219
  • 2
  • 4
  • 11
0
votes
1 answer

Return value to csh script using Perl

I wrote a Perl script, and it returned 1 or 0 depending on whether it fails/succeeds. I had a .csh shell script that reads the return value. The .csh command is this: > setenv CHECKER `perl $BIN_DIR/sgRevisionChecker.pl` if($CHECKER) then do…
0
votes
1 answer

How do you echo a string from a list in cygwin shell script

seven="( . 1 . 1 . 1)" octal="zero one two three four five six seven" for n in $octal do echo $n done When this gets to seven it echos "seven". How do you get it to echo ( . 1 . 1 . 1) which is the string for $seven?
0
votes
1 answer

csh script foreach and symbolic link

I have created the following test1.csh and test2.csh to debug an error from link_grib.csh which is a .csh script that comes from a climate simulation software package called WRF. I do not have superuser access on this Linux server. The provided…
frank
  • 1,283
  • 1
  • 19
  • 39
0
votes
1 answer

Problems redirecting stdin to csh script for a simple C line reader application

I need to write the Solaris the 'line' application on Solaris, which is very simple, on Linux. It was developed for scripting, it takes one line of stdin and outputs it to stdout. I wrote an extraordinarily simple C program to do this. I used both…
jiveturkey
  • 2,484
  • 1
  • 23
  • 41
0
votes
1 answer

tcsh: using "-c" option doesn't work for certain commands

I want to run a tcsh script from within perl. So used the -c option. However I am having problem with setenv used within the script My script XX.tcsh has setenv xx dd If I try to execute this script using "tcsh -c XX.tcsh" I get the error setenv:…
0
votes
1 answer

linux print variable vaule in foreach loop a1,a2,a3

I have a an old csh script (which hopefully I have time to rewrite in perl) which has a series of variables wmr1, wmr2 ... wmr24. What I would like to do is echo the values of each variable using a foreach loop eg foreach i(`seq 1 24`) echo…
moadeep
  • 3,988
  • 10
  • 45
  • 72
0
votes
1 answer

UNIX\LINUX: How to add a directory text to each line inside a file?

UNIX\LINUX: How to add a directory text to each line inside a file? NOTE: I am just using shell(CMD TOOL OF LINUX REDHAT EPIC) no other... You see I have many log files(.txt.gz) and I was able to open all of them just by using: foreach i…