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

How to open a file which is in read write execute mode in C (shell programming)

I am trying to create a file, but it is opening in locked mode. How to make it in read write execute mode? switch(choice){ case 1: printf("\n Enter the file: "); scanf("%s", file); open(file, O_CREAT, S_IRWXG); break;
user2899997
  • 3
  • 1
  • 4
0
votes
1 answer

basic program output redirect not working in CentOS V. 2.16.0 release 5.8

Generally > or >& both work when I am redirecting output from a program that is run from a C Shell script, but these are not working for basic output redirection to a log file in CentOS v.2.16.0 release 5.8 (final) Gnome desktop. When I try to…
0
votes
1 answer

Order of execution of .cshrc and .login

After extensive research, I read that on login, the login shell executes the .cshrc and the .login files in my home directory. But the order of execution depends on the shell programme. How do I find the correct order of execution of the above…
Programmer
  • 6,565
  • 25
  • 78
  • 125
0
votes
2 answers

Changing the default Unix shell without impact on remote logins

Is it possible to change the default interactive shell of a user on a Unix (Solaris) system without any impact on other software that remotely logs in via the same username (eg: via rsh or ssh). Rationale: my company sells multi-million dollar…
compie
  • 10,135
  • 15
  • 54
  • 78
0
votes
2 answers

csh script variable substitution

I have a small script that performs the following actions. I have simplified it for this example. set logfile=$HOME/LOG/output.log find execute.sh -type f -exec csh -c '"$1" >& "$logfile" &' {} \; The issue is that the find command is not…
McArthey
  • 1,614
  • 30
  • 62
0
votes
2 answers

Exclude permission denied messages from find

In bash, I can redirect stderr using 2>&1 with the find command and pipe it to grep to remove any Permission denied messages. How do I do this in csh? I am getting the error message Ambiguous output redirect. I have already tried the syntax at this…
Engineer2021
  • 3,288
  • 6
  • 29
  • 51
0
votes
1 answer

Execute alias in cshrc

I have alias which contain small script. We generally call alias with username argument. For small enhancement,we need to call from shell script. I have write into shell script but it looks like that it does not…
user765443
  • 1,856
  • 7
  • 31
  • 56
0
votes
0 answers

Repeat printf arguments with command line operators

I want to repeat the same argument $i for the instances 03-12. I'm really trying to use some nco operators - but the printf statement is hanging me up. I'm trying to use an netcdf operator on it - where these outputs of the printf are the input…
dianei
  • 31
  • 4
0
votes
1 answer

Repeat printf arguments

I've found some related posts, but nothing seems to work. I want to repeat the same argument $i for the instances 03-12. I'm really trying to use some nco operators - but the printf statement is hanging me up. #!/bin/csh set i = 1 while ($i < 2) …
dianei
  • 31
  • 4
0
votes
1 answer

Passing csh array to awk

I'm having a problem with a csh script that i'm writing. What i wanna do is to read a file, and for every new line of this file that i'm reading, assign a new value to a certain variable that i'll use later. To make it simple I have a string, array…
Francesco
  • 51
  • 4
0
votes
0 answers

Cshell: to use "shift" but for an argument in the middle

I want my Cshell script to process through my $argv list, but to cherry-pick through that list. For example: @ i = 1 while ( $i <= $#argv ) if ($argv[$i] == "--ignore-externals") then set svnargs = ( $svnargs $argv[$i] ) shift $argv[1] …
macetw
  • 1,640
  • 1
  • 17
  • 26
0
votes
2 answers

Error in if statement in shell script

I am trying to execute the following shell script #!/bin/csh if [[ $# != 1 || $1 != "first" && $1 != "second" ]] then echo "Error: Usage: $0 [first|second]" exit 1 fi but I am getting an error: if: Expression Syntax. I have no idea what's…
Uttam Malakar
  • 684
  • 1
  • 6
  • 15
0
votes
1 answer

Unix cut in c shell

in file ~/x, --- //zep/arod/jo/new/ded/main/changes 2013-05-13 17:14:34.000000000 -0700 --- //zep/arod/jo/new/ded/main/lib/soph/tool.py 2013-05-16 14:14:34.000000000 -0700 --- //zep/arod/jo/new/ded/main/lib/soph/pomp.py 2013-05-16…
ealeon
  • 12,074
  • 24
  • 92
  • 173
0
votes
2 answers

wait for two PID in c-shell

Following works for me: >sleep 20 & [1] 30414 >sleep 30 & [2] 30415 >wait $30414 $30415 This works all right until I want to write this into tmp.csh In my tem.csh file sleep 20 & set pid1=$! sleep 30 & set pid2=$! When it comes to "wait" wait…
thundium
  • 995
  • 4
  • 12
  • 30
0
votes
1 answer

Aliases in GNOME Terminal 2.16.0 are not being set

The alias command is not working and I believe I am following the correct syntax for example: alias np='ls -la' I have also tried speech marks: alias np="ls -la" In both cases the response to np is np: Command not found. However, if I run alias…