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

extract substring using cshell

I need little help on extracting string using csh. I have a variable containing a long string ending with _abc. I need to extract the whole string except _abc using csh. please help
XYZ_Linux
  • 3,247
  • 5
  • 31
  • 34
0
votes
1 answer

Read user input in both bash and csh

I'm trying to create a script to to do simple things. I need to prompt the user to reply to a question, typing yes or no. The script is written for csh, but does not work when default user shell is bash. My environment is Red Hat Enterprise Linux…
user1657743
  • 141
  • 1
  • 2
  • 5
0
votes
1 answer

set var in Csh script

I'm creating a script like this #!/bin/csh set h=1; while [h=1] do echo "hi"; h=2; done; but when I execute it a get this: ===> message after : csh test.sh [h=1]: No match.
Os M Torvalds
  • 21
  • 1
  • 2
  • 5
0
votes
1 answer

what are good resources to get the most out of csh or tsch?

I would like to get the most out of working in cch or tcsh shell. I am looking for general tips (post them away), online tips, or book. Thanks
vehomzzz
  • 42,832
  • 72
  • 186
  • 216
0
votes
1 answer

Passing Arguments from wrapper script to the binary being called in cshell

I have a wrapper run script lets call it wrap_app.sh All it does is call some binary ./mybinary --run-test --run-allnew "$@" Now when I invoke it I can provide it additional arguments in bash ./wrap_app.sh --run-new-arg and these arguments will…
anijhaw
  • 8,954
  • 7
  • 35
  • 36
0
votes
2 answers

Does double quote makes any difference in setenv command in Linux csh?

I am setting an environment variable - say ABC - in C shell in SuSe Linux. My question, are there any difference in following 2 commands? $setenv ABC "1" $setenv ABC 1 In both the cases echo gave me the same result. i.e $echo $ABC 1 For me, it…
SS Hegde
  • 729
  • 2
  • 14
  • 33
0
votes
2 answers

Linux tr command

I'm relatively new to programming in c-shell and I'm having a problem with the tr command. When I execute the script, the error message I receive is "tr command not found". I'm also trying to display the contents of a file in foreach loop that I've…
demet8
  • 1,089
  • 5
  • 14
  • 26
0
votes
2 answers

Listing shell variables with specific characters

I have in c-shell some variables referring to file names. Those variables are named like: $T01aa2 $T12aa2 $T45aa2 etc. They have in common the "T" and the "aa2". How can I list these variables in a loop for instance as I would do if they were…
0
votes
1 answer

Missing .cshrc file

I've installed cshell on Ubuntu 12.04, but there's no .cshrc file (either in ~ or /etc) - is it safe to create 1 to put a source to a script file, and if so, where's the best place to put it?
ChrisW
  • 4,970
  • 7
  • 55
  • 92
0
votes
1 answer

What is the correct syntax for !:1- in csh

Im creating an alias like this in my cshrc file but I can't get it to work properly alias fxg "find . -type f -name \!:1'*' | xargs grep \!:2-" From what I understand!:2- should give me the arguments from the second to the last. alias fxg "find .…
Pablo Jomer
  • 9,870
  • 11
  • 54
  • 102
0
votes
4 answers

Perl script redirect stderr and stdout to a file

I'm having trouble doing this. My script prints messages to stout and stderr, and I want them all to be directed to a file that I can view at my leisure later. Here is what I tried: $location/myscript.pl -arg1 $var1 -arg2 $var2 -verbose 1…
JDS
  • 16,388
  • 47
  • 161
  • 224
0
votes
1 answer

How does "watch" work on concatenated commands?

Something has been bugging me a while now: watch cat file works fine and reports output in the file every 2 secs. watch cat file | grep "text" does work, but its all weird in only one row. What is the correct syntax for coupled commmands over…
tarrasch
  • 2,630
  • 8
  • 37
  • 61
0
votes
3 answers

Why commands in .bashrc are not executed?

I have the following lines in my .bashrc which I would like to get executed upon logging in through ssh. csh source /x/y/.cshrc source /x/y/z/sourceme But the problem is that only the first command is being executed correctly. (csh prompt is coming…
gkns
  • 697
  • 2
  • 12
  • 32
0
votes
1 answer

Cannot source script in .cshrc

A library I'm using has a script to set the appropriate environment variables: # Source this script to set up the ROOT build that this script is part of. # # Conveniently an alias like this can be defined in ~/.cshrc: # alias thisroot "source…
smead
  • 175
  • 1
  • 2
  • 5
0
votes
1 answer

csh script run from Java GUI crashes and freezes terminal

I have a script that I run from a Java GUI. It executes a SQL script and writes the results to a log file in the tmp directory. The rest of the script should open up an xterm and display the results of the output file to the screen. It creates the…
rambokayambo
  • 341
  • 4
  • 10
  • 27