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
29
votes
2 answers

Ctrl-R to search backwards for shell commands in csh

I love this shortcut in borne shell, and want to find out if it is possible to simulate and/or have (perhaps to install an add-on or with a script) it in csh or tsch thanks
vehomzzz
  • 42,832
  • 72
  • 186
  • 216
25
votes
2 answers

How can I view only the first n lines of the file?

I tried head +10 and it didn't work.
vehomzzz
  • 42,832
  • 72
  • 186
  • 216
23
votes
1 answer

SSH then change Shell

Potentially a real easy question but I was wondering if anybody can kindly provide some advice. To accomplish a repeating task, I am constantly logging into a remote Solaris server using credentials given to us from our system admin. However, each…
user2511875
  • 493
  • 3
  • 6
  • 13
22
votes
9 answers

how to source a csh script in bash to set the environment

We have Oracle running on Solaris, and the shell is by default csh. So the login script sets the oracle_home, oracle_sid in csh also. But I don't like csh and want to use bash to do my work. So how to source the csh login script in bash? e.g, the…
Daniel
  • 621
  • 3
  • 9
  • 18
21
votes
5 answers

Checking in bash and csh if a command is builtin

How can I check in bash and csh if commands are builtin? Is there a method compatible with most shells?
Natan Yellin
  • 6,063
  • 5
  • 38
  • 57
21
votes
5 answers

bash vs csh vs others - which is better for application maintenance?

Possible Duplicate: What Linux shell should I use? I am starting to get proficient in a Linux environment and i'm trying to pick a weapon of choice in terms of command shell scripting (as i'm still a big n00b at this) that will help me (and…
LoudNPossiblyWrong
  • 3,855
  • 7
  • 33
  • 45
20
votes
7 answers

How to use parallel execution in a shell script?

I have a C shell script that does something like this: #!/bin/csh gcc example.c -o ex gcc combine.c -o combine ex file1 r1 <-- 1 ex file2 r2 <-- 2 ex file3 r3 <-- 3 #... many more like the above combine r1 r2 r3 final \rm r1 r2 r3 Is…
Lazer
  • 90,700
  • 113
  • 281
  • 364
19
votes
2 answers

How can I echo commands in a tcsh script?

Yes. I know I shouldn't be using it for scripting. Yes. It is rubbish. I am indeed a fool. Nevertheless. I'd like to see the commands the script is executing, for debugging purposes. I think you get this effect with set -x or set -v in bash…
John Lawrence Aspden
  • 17,124
  • 11
  • 67
  • 110
18
votes
2 answers

Redirecting stderr in csh

I'm executing a program that dumps crash report into STDERR from where I have to filter some necessary information. The problem is that I'm unable to redirect STDERR to STDOUT and PIPE it with grep command 2>&1 >/dev/null | grep "^[^-]" >&…
PYPL
  • 1,819
  • 1
  • 22
  • 45
18
votes
4 answers

Extract one word after a specific word on the same line

How can I extract a word that comes after a specific word in Linux (csh)? More precisely, I have a file which has a single line which looks like this: [some useless data] --pe_cnt 100 --rd_cnt 1000 [some more data] I want to extract the number 100…
Rahul
  • 371
  • 1
  • 2
  • 12
17
votes
8 answers

How do you use newgrp in a script then stay in that group when the script exits

I am running a script on a solaris Box. specifically SunOS 5.7. I am not root. I am trying to execute a script similar to the following: newgrp thegroup << FOO source .login_stuff echo "hello world" FOO The Script runs. The…
Paul
  • 198
  • 1
  • 9
  • 22
15
votes
3 answers

Run du on parallel

I have a very big storage disk (16T). I want to run 'du' on it to figure out how much each subdirectory takes. However, that takes a very long time. Luckily, I have at my disposal a cluster of computers. I can therefore run 'du' on parallel, each…
R S
  • 11,359
  • 10
  • 43
  • 50
15
votes
1 answer

Expand aliases in non-interactive shells

In bash, we can use shopt -s expand_aliases to expand aliases in scripts. What are the equivalent commands for zsh, csh, and tcsh? Do they even exist? In focusing my efforts on zsh, I haven’t found such a command. I even tried sourcing the file with…
user137369
  • 5,219
  • 5
  • 31
  • 54
14
votes
3 answers

MVC 3 Razor @Html.ValidationMessageFor not working in partial loaded via jquery.load()

I have put together a small example here just to replicate the problem. I have a strongly typed partial view _Name.cshtml: @model ValidationInPartial.ViewModels.MyViewModel

@ViewBag.Message

Name
Roberto D
  • 143
  • 1
  • 1
  • 5
14
votes
2 answers

how to check existence of any file in csh script?

For checking the existence of any file in csh script I am using if [ -f /var/opt/temip/conf/.temip_config ] but I am getting below error if [ -f /var/opt/temip/conf/.temip_config ] if: Expression Syntax. Can anyone tell me how to do this?
dcds
  • 437
  • 2
  • 9
  • 20
1
2
3
78 79