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

0
votes
1answer
73 views

Simple if command not working in csh script

I have made a basic shell script using IF command as a purpose to help myself as I am a beginner. Problem is that when I execute this script using source overspeed (after giving myself execute ...
2
votes
1answer
25 views

Automatically set number in vim without modifying vimrc because of limited permission

Hi since I dont have permission to modify vimrc. But I really need to view the line numbers every time. Is there an alternative way to do the following without modifying the vimrc file?Thank you! :...
1
vote
2answers
31 views

Cronjob runs a script which calls another script

my cronjob look like this: 0 3 * * 0-6 somedir/promotionscript But promotionscript is actually calling another file "config" located in the parent folder of somedir. #promotionscript #!/bin/csh ...
0
votes
1answer
24 views

how to make sure csh won't mess up your tcsh history timestamps?

I use tcsh as my default shell. Sometimes, I run csh (e.g., for testing), and it messes up my savehist history file, particularly, the timestamps -- lots of events end up appearing under the exact ...
0
votes
1answer
10 views

make ${m} ARCH=${ARCH} >&! Make_${m}

I am new player in Linux. In this command (C shell script) make ${m} ARCH=${ARCH} >&! Make_${m} what does >&! mean?
0
votes
1answer
28 views

Get parent directory in cshell script

Hi I'm trying to get parent directory in cshell script but the following code found not working in cshell script: #!/bin/csh -f set dir=$PWD set parentdir="$(dirname "$dir")" Error info: Illegal ...
0
votes
0answers
54 views

Why alias could not be found in the shell

I was trying to set the alias for command: {cutadapt -O 24 -q 19,19 -m 30 -g TATAGAATTCGCGGCCGCTCGCGATAATACGACTCACTATAGGGCGTTTTTTTTTTTTTTTTTTTTTTTT -g ...
1
vote
1answer
57 views

error:too many words `` in cat

I have a csv file that auto-generate with filename format yy-mm-dd_h. The csv file content: Status Filename 1 1A-W02_ws_r0_apr13_15_44.stdf 1 2A-W04_ws_r1_apr12_10_30.stdf 1 1A-...
1
vote
0answers
45 views

C shell. Make script wait for Gnome-terminal to finish

I am working on a script that has to process a lot of data. All comes down to 3 commands. I use: #!/bin/csh gnome-terminal -e "ssh $servername1 'command 1'" & gnome-terminal -e "ssh $servername2 ...
1
vote
0answers
27 views

Adding corresponding elements from two arrays into new array using csh shell?

I want to use a csh script to merge corresponding elements of two arrays into another array. My script gives error as:- arrayfinal[1]: No match. the results is 0 0 0 0 0 my script is #!/bin/csh ...
1
vote
2answers
48 views

How do I create a rule for custom flag replacement with C shell?

I want to have the following behavior with grep: grep --java <rest of the command> Where --java would either dynamically convert to --include=*.java or internally be equivalent to it. Is ...
2
votes
1answer
94 views

What kind of redirection is >>&?

I'm looking at a cron file that has the following line: 35 0 * * * /bin/csh -c "/home/abc/.cshrc;/home/abc/appTools/bin/xxx.pl >>& /home/abc/appTools/log/xxx.cronlog" Is this another ...
1
vote
0answers
41 views

Read and write line from .txt, in CSH script [closed]

well I have to do a basic script,is mandatory in csh, and I decided to do a simple "task manager". Based on a .txt file, the user can add task, show tasks, delete X task. The problem I don't manage to ...
0
votes
1answer
190 views

Unwanted question mark appended to directory name when using mkdir

I am unsure why when I use mkdir -p $fbase an unwanted ? is appended to the name of the directory (27obs87St01Rec1?) . I have followed similar threads and ran cat -A filename to see if there are ...
1
vote
0answers
36 views

Piping to 'tee' commands prevents changes in environment variables

I have a csh script using which I modify certain environment variables and echo values of these environment variables from within this script. I source this from another script: source "$...
1
vote
0answers
48 views

Setting environment variable using shell script

I am using csh scripts for some automation purpose. I have a number of scripts, and the beginning of all of which I need to set a fixed set of environment variables. |----SCRIPT 1---| |----SCRIPT ...
1
vote
1answer
52 views

cshell alias: How to use nested single quotes(') in in cshell alias

I am trying below alias in cshell: alias sll 'ls -l \!* | grep -oE '[^ ]+$' | paste -s | xargs ls -l' For this CSH says, Illegal variable name. If I use \$, alias will be set without any error. ...
3
votes
1answer
415 views

Odd alias “find . -name '*\!{*}*' -ls” in Unix Power Tools

From Unix Power Tools 3rd Edition page 175: Article 9.27 shows a way to match directories in the middle of a path. Here's a simpler "find file" alias that can come in very handy: alias ff "...
2
votes
0answers
41 views

unix c-shell : disk checking

im totally new in shell scripting. I have task to simplify an old c shell script. Basically, the script have 10 devices that using hp-ux and i want to check the disk space in each devices. my ...
1
vote
1answer
60 views

C Shell Script syntax error “unexpected end of of file”

I am trying to write a c-shell script that checks for number of arguments and echos a string, but I am getting an unexpected end of file syntax error and I don't understand why. Here is what I tried: ...
0
votes
0answers
36 views

Unix -untar files only looping one time - C-shell

I have list of *.tar.gz files that I want to unzip and untar at once. The code: foreach summ (`ls *.tar.gz`) gunzip -d < $summ | tar xf - end But only one file has been untarred. How would ...
1
vote
2answers
58 views

Merging two files using scripts

I am trying to merge two files of different lengths using a script. I want the longer file to be appended to the end of the shorter file and when both files are of equal length they are suppose to ...
0
votes
0answers
30 views

Escape special chars in csh alias

I want to create an alias for the following thing: diff -r <dir1> <dir2>| grep diff | grep -v "Files " | grep -v "\.git" \ | awk '{print "tkdiff " $3 " " $4}' I am getting lost with ...
0
votes
0answers
40 views

Help me with C-shell Script: Disk checking

i am new in shell script. i have given a task to make a C-shell script. I have list of ip address and device name respectively. For example; cal 1 : 100.21.25.10 cal 2 : 100.21.25.11 cal 3 : 100.21....
1
vote
1answer
49 views

Alias gedit to accept an argument

This alias works in UNIX and in Redhat. It does not work in Fedora alias te 'gedit "\!*" &' Usage: te myfile.cpp It opens gedit with myfile.cpp in the edit window and runs in the ...
0
votes
0answers
82 views

why are directories which are empty not removed after rmdir?

foreach file (`find . | awk -F/ 'NF == 3'`) echo $file set olddir = `echo $file| cut -f 1-3 -d '/'` echo $olddir set newdir = `echo $olddir | cut -c 1-2,5-` echo $newdir mkdir -p $newdir ...
1
vote
3answers
117 views

csh: Using -d as an argument and not test

I know that -d /path/to/dir can be used to test command for checking a directory. Then: if ( $argv[1] == "-d" ) does not work because of that. However, I need to be able to pass -d as an argument ...
7
votes
3answers
113 views

'switch' based on shell

I would like to source (i.e. not call) a script from any shell (bash/csh are the primary targets, but fish, zsh, ksh, and rc would also be interesting). I would like if the script can be a single ...
1
vote
2answers
219 views

how to do inverse cut?

I am sill new in this. I would like to ask, how to inverse the cut? Example; ./24feb/frfr I want after cut command, the result will be ./feb/frfr. How to do it?
-1
votes
1answer
50 views

Avoid pgrep in csh

I got that code foreach pr (`pgrep "$NAME"`) And I try to avoid pgrep: foreach pr (`grep "$NAME" | awk '{$2}'`) but that does not really work. (later with that pr should be the PID printed out ...
0
votes
2answers
268 views

Bourne Shell to CShell

This works fine: #!/bin/sh ALTER="$1" NAME="$2" for pr in $(pgrep $NAME); do elapse=$(ps -o etime= -p $pr) [ "${elapse%:*}" -gt "$ALTER" ] && echo $pr done But if I try to switch ...
1
vote
0answers
161 views

csh: redirecting output from foreach

In csh: How do I redirect the output from a foreach-loop to a pipe? This works but uses a temp file: set tmpfile=/tmp/file ...
1
vote
2answers
111 views

List files in hierarchy of directory

I need to list files in hierarchy of directory. For that I wrote script like foreach file ( * ) ls ${file}/*/*/*/*/*.root > ${file}.txt end But for this I have to know that in the directory $...
0
votes
1answer
83 views

Is there a GUI debugger for csh script?

I have read another question in UNIX & LINUX stack exchange. The GUI provided in that question can be used to bebug *.sh file. How about to debug *.csh file? What other plugins for eclipse can I ...
2
votes
1answer
61 views

csh: Convert aliases into commands that set these

The command alias lists the active aliases. But it does this in a way that is different from how to set the alias: % alias foo 'bar \!*' % alias baz quux xyzzy % alias corge 'grault \ garply (quux ...
1
vote
1answer
791 views

How set environment variable permanently in Red Hat Linux?

As I'm using Red Hat Linux 5.3, I'm unable to set environment variable permanently. I want the file names for csh, from which I can add the environment variables permanently.
1
vote
1answer
61 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
146 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
46 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
74 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 ...
2
votes
2answers
104 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
280 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
31 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
203 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
680 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
853 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
144 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
2k 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
3k 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 /usr/bin/...
0
votes
1answer
195 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 $_ ...