The C shell (csh), once one of the two major Unix shells with the Bourne shell. Csh had more advanced interactive feature but has been surpassed by modern Bourne-style shells such as zsh and bash.

learn more… | top users | synonyms

-2
votes
0answers
14 views

Why my running results are different with the same input files when in csh and ksh settings?

Same machine, same input files, same executable. Two user accounts. One set environment variable using csh, the other uses ksh. The running results are different! Don't know what happened. Please ...
1
vote
1answer
18 views

csh array/command substitution with gnu parallel

First of all, yes, locked into csh on a Solaris box, can't do anything about it, sorry. I have a report batch I was running using a foreach loop. Right now it runs as a single thread and I would like ...
0
votes
1answer
30 views

C Shell Argument If Else Loop

I am new to C -Shell programming. I am writing a script that, if one or more arguments are entered after the script, it will display them. if no arguments are entered, it will say "Please enter one or ...
0
votes
0answers
42 views

Adding strings in front of the prompt

I am trying to add an additional string in front of the 'login' names that I usually see in my terminal. Currently, this is what I am seeing, where 'zac' is my user alias and 'titem' is my machine ...
1
vote
0answers
32 views

csh: How to save the shell environment (env, current dir, shell history) in a file and set it on another shell?

I start interactive terminal using farm (LSF). These terminals get opened on some random host and get closed automatically after 15 days. I want to save the current shell environment (env, current ...
0
votes
0answers
38 views

CSH: Determine index number of string in an array

I am using csh. Consider an array of arbitrary length: set array = ( abc def ghi ) I have the following variable set var = "def" How can I find $var in $array and determine its index value? I ...
2
votes
2answers
42 views

Add an application to the command search path in csh

Recently, I have installed an application (gnuplot) under user directory (/home/usr/bin). I want to run the application whenever I type 'gnuplot' in any directory. What could I do? I tried to set the ...
2
votes
1answer
47 views

csh: setting command completion for `cd` to show both directories and files

In my csh terminal, when I do: ls tab -- it shows everything in the current directory as a possibility cd tab -- it shows only directories in the current directory as a possibility. If no ...
1
vote
0answers
12 views

How to install iwidgets without root access and set the enviornment

Recently, I want to run a script(PWgui) which requires Tcl (Itk). The manual suggests that I have to install iwidgets4 beforehand. I am using the university cluster and don't have any root privileges. ...
0
votes
1answer
57 views

csh: Terminal inherits environment variables from an unknown location

I'm on a shared machine running CentOS 5.10 that I log onto using VNC from Windows 7. Our default and official shell is csh. Every time I open a new terminal, I have three particular environment ...
1
vote
1answer
66 views

Read data from a file in a csh script

Is there a way to read data from a csv file into a Cshell script? I have a small script, which calls another script recursively with a set of parameters. I want to read this set of parameters from a ...
5
votes
1answer
131 views

Source Bash automatically in terminal

How can I automatically source a particular bash script when I open a terminal window by right clicking somewhere and choosing "open in terminal"? For example, every time I open a terminal I need to ...
1
vote
2answers
52 views

CSH and all output (with errors) to file

I need save all output from compilation to file. I have many errors "undefined reference" and I want see all of these errors. I try "makeall >& out", but in file "out" aren't any of error ...
2
votes
2answers
338 views

Is it possible to send a HEREDOC over ssh to a remote host from inside a script running locally?

I essentially want to run a script on machine A which will SSH into machine B, execute commands on B, and return the output to machine A. So I am creating a csh script to do this, hopefully, if it's ...
1
vote
2answers
441 views

What do unlimit and limit do in the context of csh?

I'm running a csh script that calls unlimit and limit just before running a scientific model. The script looks something like so (truncated for brevity): #!/bin/csh -f # ... unlimit limit ...
0
votes
1answer
80 views

What does dollar underscore mean in tcsh? $_

In a script I'm debugging, I see it use $_ at the beginning of the file. It appears to suck in the full command that called the file. When trying to wrap this script in another script though, the $_ ...
0
votes
1answer
63 views

How to set the path of the default compiler in ./cshrc

I am using a unix workstation with C shell. There were two compilers of mpif90, one compiled with ifort and one with gfortran, installed on the system. The default mpi compiler was the one compiled ...
-1
votes
1answer
41 views

csh: Get rid of job+PID when forking

With bash I can run: $ ssh bashuser@localhost '( ls -d / nosuchfile ) & echo foo; wait' foo ls: cannot access nosuchfile: No such file or directory / If I try the same with csh I get: $ ssh ...
3
votes
2answers
115 views

Compatibility scripting: Save $? for use later

I would like to write a small part of a script that saves the error status, executes some other code, and sets the error status to the original error status. In Bash it looks like this: << some ...
2
votes
2answers
248 views

Event not found in sed call in csh script

I tried the code as given on delete text between curly brackets however I am facing this different error regarding event in sed. file contains: This is { {the multiline text} file } that wants { ...
0
votes
1answer
68 views

Declaring User-Defined variables in the C shell in UNIX read-only

I'm having trouble finding documentation, but what is the command to make a user defined variable in the c shell read-only in unix?
3
votes
0answers
109 views

parametric aliases in csh to add export command

I'm trying to find a way to translate functions to csh/tcsh aliases, since they lack functions but have parametric aliases. As a first step I'm trying to create an export command. Here's what I've ...
6
votes
1answer
353 views

Are there problems with hyphens in functions, aliases, and executables?

In my testing (in Bash and Z Shell), I saw no problems with defining functions or aliases or executable shell scripts which have hyphens in the name, but I'm not confident that this will be okay in ...
1
vote
2answers
68 views

C Shell: different actions depending on the file type

I very new to C Shell. I am trying to read a file from the command line, and determine whether it's a zip file, a .txt, a symbloic link, a pipe, or whatever ("unknown"). Then I'd like to execute a ...
4
votes
4answers
412 views

Text files containing their own name

I need to find in certain directory and all its' subdirectories all text files that contain their own name. How do I do this? (preferably without awk command)
1
vote
1answer
54 views

How to logout CSH session?

I connected to CentOS server via SSH. In SSH terminal I executed csh command mistakenly. Now when I use logout command it throws Not a login shell. output. How can I logout CSH and return ...
1
vote
0answers
34 views

CSH - if: Expression syntax error [duplicate]

There's this daemon with, for ex. 5 types in one script. Now, i want to be able to start/stop it by specifying the number of the daemon(to start one by one), OR specify "all" (to start in bulk). The ...
0
votes
1answer
507 views

CSH - How to check if input is NOT number

Please help, I can only see forums with this question for Bash, KSH, and others Need to apply it on csh. to check if the inputted $2 is not number nor the word "all" if ($#argv == 2 && ($2 ...
1
vote
1answer
14 views

Locating the terminal currently in use

I need to write a script to test if im using the correct terminal and then print a message This is what i have so far if(???? == dev/pts/1) echo Access Granted. Welcome. endif I dont know how to ...
0
votes
1answer
98 views

evaluating a string in csh

script1 is as follows #!/bin/csh echo $* $* Then I run the following on command line: >script1 setenv VAR "/user/path" \; ls It gives output as: setenv VAR /user/path ; ls setenv: Too many ...
1
vote
1answer
222 views

Rounding float numbers in csh

I have a float number stored in a variable $temp, like 3.046789. How we can round this number with 2 digits precision and the result I need is 3.05. The script I have is a csh script.
2
votes
1answer
376 views

Writing a simple rc.d script in FreeBSD

I would like to run the ELK stack in a FreeBSD Jail on an FreeNAS host. I have a hard time to get an simple init/rc.d script to work. #!/bin/sh . /etc/rc.subr name=logstash rcvar=logstash_enable ...
0
votes
1answer
208 views

How to wait until script ends - csh?

I execute a script that splits a big file into little files. Immediately afterwards I ask if (-f *filename) then .... Sometimes the script doesn't finish so the if doesn't work. I tried sleep but ...
1
vote
0answers
73 views

Verbose output in logfile and simple output on screen?

Let's say I have the following script: script.sh and i want the verbose output in a logfile and simple output on screen. Logfile should contain the csh -v script.sh output, and on the screen should ...
1
vote
4answers
241 views

How can the following script be explained?

Code: #!/bin/csh if ( A$1 == A ) then echo "" echo "LIST <name>" echo "" exit endif .............. Ok this is a sample from a bigger script I got. The scripts starts with ...
1
vote
0answers
82 views

alias Not able to execute source command

I am trying to define a following alias in my .aliases file. alias sett 'cleartool setview viewXYZ_!*; cd /path_dir1/dir2/; source ./env/script-name' I use it as sett myview on commnd prompt when I ...
2
votes
2answers
998 views

How to enable double tab autocompletion list in csh?

I've worked in Linux before where when I press tab it autocompletes until it becomes ambiguous. If I pressed tab twice at that point it would give me a list of all possible completions. My current ...
1
vote
1answer
56 views

csh: Is there a prompt outside of $prompt?

Consider this c-shell grab: [<my-user>@<my-host> ~]>echo $SHELL /bin/csh \033]30;<my-host-name>\007\c [<my-user>@<my-host> ~]>set | grep prompt prompt [%n@%m ...
1
vote
2answers
249 views

Will a '*' (star) in globbing match only characters (i.e , a-z and 0-9)?

I havie a simple question here: does a * (star wildcard) match only characters (letters and numbers) in glob style? Or will it also match special characters? In bash, * matches everything, while in ...
2
votes
1answer
1k views

syntax error: unexpected end of file

#!/bin/csh -f set no=1460 while ("$no">0) if [$no>900]; then set m=3 else if ["$no">450 && "$no"<901]; then set m=2 else set m=1 fi mv *$no.bin test/abc-$m-$no.bin set no ...
1
vote
2answers
177 views

Create file with specific formatting from directory contents

I am using Solaris and csh. In $home/test there are five files: a.txt, b.txt, c.txt, d.txt and e.txt. If I run % find $home/test/ -type f -print > ../filenames.txt that file will look like: ...
2
votes
1answer
3k views

C Shell script condition for if string contains a newline character

I'm not sure how to express this using the csh string matching syntax. I want to test whether a csh variable contains a newline. I'm basically looking for: if ($mystr !~ <pattern for strings which ...
1
vote
1answer
407 views

What causes a csh script to sometimes not source /etc/csh.cshrc?

I have a csh post-installation script that is executed from an rpm %post with its interpreter line set to #!/bin/csh (without the -f option). This should cause the file /etc/csh.cshrc to be read ...
1
vote
1answer
168 views

Illegal float value “error” c-shell

I have a form made it with a couple of text boxes, in which I input floating numbers and use this number to sum with other text box and put the result in a label. I then input the values of the text ...
2
votes
3answers
263 views

How do I make pasted shell commands invisible?

I'm using an AutoHotkey macro to run some shell commands, i.e. ^`:: SendInput set c=".cshrc-acheong"{ENTER} SendInput set v=".vimrc-acheong"{ENTER} SendInput foreach d ( /home/acheong /home/tcama ...
0
votes
1answer
63 views

Script in C shell skipping over last else statement?

This is a C shell script that checks the number of arguments and if the file/directory exists. When the arguments are valid, it should go to the last else statement and print "hi", but when I run this ...
2
votes
1answer
135 views

Which is the real PATH variable

On my office computer it seems like I've have two PATH variables. $path : This is delimited by " " (Space) $PATH : This is delimited by ":" (Colon) Though when I update one, the other one ...
2
votes
1answer
2k views

Changing text color in c-shell

I can change the text color in the terminal permanently by adding this: export PS1="\e[0;31m[\u@\h \W]\$ \e[m" to the .bashrc file. Now I have to go into cshell, what is the corresponding way?
0
votes
3answers
218 views

I want to print a line when a user login [duplicate]

I what to print "you are on an important server" whenever a user(any user) login to a server. Is the way is to edit each user .cshrc file?
9
votes
2answers
2k views

Is it possible to redefine the tilde ('~', home directory)?

Is it possible to redefine the home directory? e.g. to /ext1/username instead of /home/username, i.e. expanding the ~ to another directory (as opposed to changing the actual home directory where ...