Questions tagged [csh]

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.

Filter by
Sorted by
Tagged with
1
vote
2answers
231 views

Syntax for `repeat` with a semicolon in the command string?

I'm keeping an eye on a process in FreeBSD using a script which outputs the current status of the job. Using the csh builtin command repeat, I'd like to run the script every 2 seconds, so naively I'd ...
-1
votes
2answers
504 views

Ambiguous input redirect error in csh

echo "yes" | my_program < input_file I'm getting Ambiguous input redirect error in csh. How to solve this?
2
votes
2answers
236 views

Setting paths for interactive C-shell

My default shell (on Ubuntu) is bash. However, for a particular programme I need to change to the C-shell. For this I have a .cshrc file set up, however, if I change interactively to the C-shell (I'm ...
1
vote
1answer
216 views

How to manipulate multiple file names using find?

How to improve the command below to change a string in a filename. find . -type f -name '*<today>*' -exec mv {} {}_renamed \; Actually I have a few files in my directory with today's date as a ...
2
votes
3answers
19k views

How to use while loop in csh shell command prompt?

I am trying to use while loop in csh shell command prompt in RHEL 7.2 but am getting the below error: $ while true while: Expression Syntax. The same is working in bash shell.
0
votes
3answers
2k views

How to replace one line with two lines using sed in csh on BSD?

I have a very simple text file here with the following contents line1 line2 line3 line4 I want to modify the contents via sed(or some other app) so it becomes line1 line2 #this line was added by ...
0
votes
1answer
531 views

ssh command in background

Please help in following. I am doing ssh user@server "source script.csh" from my home server Let us suppose script.csh contains 10 commands : 1st to 3rd command runs instantaneously 4th command ...
0
votes
1answer
205 views

Assigning / evaluating concatenated variables in tcsh

I have a tcsh puzzle, and would appreciate any help. When I run: set faceAttenRuns = (09 13) set run = $faceAttenRuns[1] echo $run This returns: echo 09. Great. But when I run: set runTypes =...
0
votes
2answers
449 views

Passing in special characters from a perl script to csh

I'm writing a perl script that takes a string and passes it into a .csh script. PerlScript.pl: $CMDLineArgs = "-stuff -more_stuff \'-even_more \"*stuff\" -last_stuff\'"; system(Script.csh $...
0
votes
1answer
2k views

How to create alias with variable in .cshrc?

For example, I want to create an alias to remove duplicate lines: alias rm.dup 'perl -ne 'print unless $dup{$_}++;'' When source .cshrc, it reports: "dup: Undefined variable." If change it to ...
0
votes
0answers
34 views

In Bash, the `*` is no longer expanded before passing into a command? [duplicate]

Is it different from C-shell? I remember in C-shell, when we do echo * then the * is actually expanded by C-shell to all filenames in the current directory, so echo really doesn't need to do ...
0
votes
2answers
396 views

Unable to redirect standard error of openmpi in csh to file

I have read this question and answer - Redirect stderr to stdout but nothing seems to work to capture the error of a software called OpenMPI on Ubuntu 16.04 LTS. I have the OpenMPI commands in a ...
1
vote
1answer
488 views

Vim mode in FreeBSD shell?

How can I switch to Vim mode in FreeBSD shell? I echoed the value of $SHELL and it is /bin/csh however man csh opens tsch's manual page. set -o and shopts are not available as well. And /etc/...
4
votes
1answer
402 views

What's special about “!xxx%s%s%s%s%s%s%s%s”?

I was linked to The Unix-Haters Handbook and stumbled on (page 149): Subject: Relevant Unix bug October 11, 1991 Fellow W4115x students— While we’re on the subject of activation ...
2
votes
2answers
3k views

Undefined variable

I am trying to use this script: #!/bin/csh foreach SUB (1 2 3 4 5 6 7 8 9 10 11 12 13 14) echo $SUB foreach VISIT (1 2 3 4 5 6 7 8) echo $VISIT grep 'StudyDate' -f /home/...
5
votes
2answers
4k views

Convert arg to uppercase to pass as variable

Is there a way to convert the command line argument to uppercase and pass it as a variable within the script being invoked? Eg. ./deploy_app.csh 1.2.3.4 middleware should convert middleware to ...
2
votes
2answers
126 views

Run 2 commands in parallel but only wait for one command to finish before starting the next

I have set up a number of processes in the background that need to finish processing before the next process can be started. While I've got this set up, there is one step where 2 programs need to be ...
4
votes
2answers
837 views

Find unique values from find

I want to find unique files inside a directory, which also have sub directories. There are specific types of files, say .lib files. There are same .lib file inside different sub directoris. I need ...
0
votes
2answers
1k views

Linux crontab — which shell am I using

In crontab, how do I know which shell it is using? for example if I want to redirect output how do I know if I need to use &> or >& (bash vs csh)
2
votes
2answers
792 views

How to create tar.gz of each file of a particular type in single command?

I need to compress and decompress each of the files of a particular type say *.html in their respective location. For decompression, I used following command, it seemed to work for me: find dir -...
1
vote
2answers
340 views

Replace filename with containing folder name (csh)

I have the exact same question as this poster but, I'm using csh. I can get the filename I want set x = V_181_V_d_2_um_phi_4.50_eV_tOn_0.5_ns/SteadyState_out.e cat "`echo $x | cut -d "/" -f1`.e" ...
0
votes
2answers
2k views

vars: subscript out of range

I have a csh script (i know i know) and inside my script i run a sql query i then turn the output into a variable to use in my next command in the script. essentially it looks like this: set vars = `...
0
votes
1answer
13k views

String comparison with strings that contain wildcard operators in C-Shell

I need to compare a pattern input by the user that may contain wildcards to a given extension. For example if the input is hy*.gif I would move the files hyland.gif and hyland2.gif in a given input ...
0
votes
1answer
1k views

How to execute an alias, encapsulated in another source file?

For instance ~/.cshrc: alias job_start 'cd $PROJ_DIR && source .env/bin/activate.csh && rehash && job_run' $PROJ_DIR/.env/bin/activate.csh: alias job_run '(cd $PROJ_DIR/...
0
votes
1answer
129 views

Installation of a software in .csh environment

I am trying to install a software called Plumed on HPC environment, which is csh based. I have successfully done installation in bash environment. Typically in bash environment, following command is ...
3
votes
3answers
3k views

Error “syntax error near unexpected token `('?”

What's in my terminal bash: settings64.csh: line 35: syntax error near unexpected token `(' bash: settings64.csh: line 35: `foreach i ( $xlnxInstLocList )' Portion of the script set xlnxInstLocList=...
1
vote
1answer
280 views

Does `csh` have the Bash equivalent of `set -o nounset`?

I have some legacy csh code that is having issues and I think the issue is related to unset environment variables that need to be set but aren't being set. Does csh have the Bash feature set -o ...
4
votes
1answer
4k views

Is there a csh to bash script translator?

Programming in C shell is considered harmful by some people, but csh scripts are continued to be written by some hardcore csh fans. Is there a free/open source converter to translate csh script into ...
0
votes
1answer
749 views

How to loop through variables

I have a command in my csh script that can give at least 2 lines of output but may be more. I am turning these lines into separate variables that I then want to pass to another command. How do I set ...
0
votes
1answer
779 views

Having problems changing umask in csh

So i'm running RHEL 6.5 and I have a user that wants to use csh for what they are doing. They also want the umask to be set to 002. So I started to put umask 002 into .cshrc and call it a day. ...
25
votes
3answers
3k views

How does a shell know home(s)?

Each shell has an environment variable $HOME set (ex: /Users/lotolo). If I'm under csh I can unsetenv HOME and still if I do cd I'll be in my home. I've tested this also on bash (unset HOME) and it'...
1
vote
2answers
231 views

Why does “ps -p proc1 proc2 proc3” show “-csh”, “-tcsh”, and “-/bin/tcsh”, whereas “ps -p proc[n]” individually all say “tcsh”?

I use tcsh (not csh), and ran pgrep csh | xargs ps -p to see why I appeared to be running csh. A portion of the results: 1529 pts/0 Ss 0:00 -csh 1764 pts/3 Ss 0:00 -tcsh 1979 pts/4 ...
1
vote
1answer
1k views

Shell script with directory input

I'm writing a shell script that is supposed to take in one parameter (a directory name) and display how many files, directories, readable files, writable files and executable files are in that ...
5
votes
2answers
1k views

Show every installed command-line shell?

How to show every installed command-line shell, (i.e. bash, zsh, etc.), with no duplicates, and nothing else, (i.e. no programs that aren't shells)? This code almost works on my Lubuntu system, (...
1
vote
1answer
797 views

Wrapping aliases in Bash

Converting an old .cshrc file into a .bash_aliases file. I've run into a few syntax issues regarding the conversion, but this involves a little more in depth knowledge of Bash. In [t]Csh, the shell ...
0
votes
1answer
250 views

Shell initialization files

Is it possible to track what files were invoked from what directories? (.login .profile, .cshrc)? The reason I'm asking is because I've deleted all init files from my home directory, but the shell ...
0
votes
1answer
212 views

foreach traversing matching conditions stored in a variable

I'm using foreach to retrieve subfolder names that matches a_condition*, following works fine: foreach i (a_condition*) echo $i end It will print a_condition1 a_condition2 ... But when I try ...
0
votes
1answer
2k views

How to use echo in csh

I am trying to write a simple script to print some of the variables extracted from another file. With all the variables defined, the aim is to print out the following line: -bad 0.0 -aswap -AMX -...
1
vote
2answers
133 views

Comment particular lines using regular expression and sed

I have a very big verilog file(~350 MiB). In that, I want to comment particular module names.So i took a sample file and tried my regular expression on it. Sample file(abc) :- module ...
1
vote
2answers
1k views

What is the equivalent of `type` (used in bash and sh) in csh?

I want to check if a command is builtin or a separate program. In sh and bash I use: $ type <command> What is the equivalent in csh?
3
votes
1answer
1k views

How to use ! in the sed command?

Apologize if you feel this question very basic. Anyways, I am typing sed '/[iI]t/ a\\ Found it!' data but it says the error event not found. I tried escaping that ! with backslash \! but it doesn'...
0
votes
1answer
2k views

awk accepting variable supplied by dollar sign in cshell [duplicate]

In c shell script, I'm trying to pass bbb to awk sub, but apparently it does not work. #!/bin/csh set aaa=a set bbb=b #And I'm using it in awk sub set ccc=`echo $aaa | awk '{sub("a",$bbb); print $...
-4
votes
0answers
25 views

How to determine current users who are logged in using a specific domain? [duplicate]

I want to know How to determine current users who are logged in using a specific domain? For example, here is the question. Please tell according to it using the grep command and use of wc. ...
-5
votes
1answer
796 views

How to determine current users who are logged in using a specific domain? | UNIX [closed]

I want to know How to determine current users who are logged in using a specific domain? For example, here is the question. Please tell according to it using the grep command and use of wc. ...
0
votes
1answer
603 views

`source …/settings.csh` not working from `sh ./test.sh`

I want to source Xilinx ise setiin64.csh file with the source command. I have source /home/xilinx/ise_14.5/14.5/ISE_DS/settings64.csh in another file, test.sh. So I want to run only test.sh file ...
1
vote
1answer
4k views

What is the exact difference between a .login and .cshrc file?

I have searched the internet and websites say that we can edit both the file as per our needs and first .cshrc file is executed and then the .login file. That is fine but what is the exact ...
2
votes
4answers
5k views

/bin/ls: Argument list too long

I am a biology person and running a program named autodock. I have some files from ZINC library in .mol2 format. As per requirement I need to split this files with the csplit command and I received ...
2
votes
2answers
9k views

ulimit command not found (without sudo) and error - coredumpsize: Can't set limit (Operation not permitted)

When i initially login to a server, I see the following error message. ullimit: coredumpsize: Can't set limit (Operation not permitted) Further, when I try to copy files into this machine, I see the ...
2
votes
2answers
194 views

bash:Syntax near unexpected error '(' [closed]

I am following a tutorial in computational microbiology: William Lindstrom, Garrett M. Morris, Christoph Weber, and Ruth Huey (2008-01-29). Using AutoDock 4 for Virtual Screening. Scripps Research ...
1
vote
1answer
3k views

Simple if command not working in csh script

Problem is that when I execute this script using source overspeed (after giving myself execute permission), it asks me "How fast are you going?" as what I set but after I enter any value it gives an ...