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.

The C shell (csh) is one of the two major historical command line processors on Unix systems, the other one being the Bourne shell (sh). A modified Bourne shell went on to be standardized by POSIX, while use of the C shell has declined.

Csh and its derivative were widely considered to have superior interactive features but inferior programming features. Newer shells such as and have since then acquired and surpassed tcsh's interactive features such as advanced command line edition and programmable completion, while the csh family has seen little evolution since the late 1990s.

286 questions
3
votes
2 answers

Error converting a bash function to a csh alias

I am writing a csh alias so that I can use the following bash function in my csh : function up( ) { LIMIT=$1 P=$PWD for ((i=1; i <= LIMIT; i++)) do P=$P/.. done cd $P export MPWD=$P } (I stole the above bash…
Chani
  • 418
3
votes
1 answer

how to do case switch statement in csh

In sh, I know I can do something like the following... #!/sbin/sh case "$1" in 'foo') /path/to/foo.sh ;; 'bar') /path/to/bar.sh ;; *) echo $"Usage: $0 {foo|bar}" exit 1 ;; esac I've searched the entirety of the internets and can't seem to find a…
2
votes
2 answers

Problem in reading text file into array in csh

I have a text file that looks like this - 1 29 12 1 22 17 1 20 43 1 48 30 1 3 0 1 21 25 1 18 9 1 14 1 1 44 45 1 52 26 1 NaN 27 1 13 46 1 5 37 1 34 23 1 39 40 whose columns I want to store into different array variables. I have used the following…
2
votes
2 answers

less does not show expected output after sourcing a script in .cshrc

In our university we have a script to setup the working environment under linux. Since I am lazy I decided to add this process to the shell initialization by adding source /setup/script to .cshrc. However since I have done so, I can't use less…
ted
  • 623
  • 2
  • 6
  • 13
2
votes
3 answers

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 to my script. How can I disable the special property…
Pham
  • 49
1
vote
0 answers

I want to access one variable defined in one csh script to another csh script. How to implement in c-shell?

Script 1: #!bin/csh set option = $< switch ($option) case 1 : ... breaksw case 2 : ... breaksw endsw script 2 : #!/bin/bash Now how to access "option: variable defined in script 1 , so that based on option content , i would write if-elseif…
Aakash
  • 31
1
vote
0 answers

Why my VM is adding backslash on every backslash in recent command

My company setups a new VM for me to work and I'm not really sure the configuration details of this VM. One interesting thing which is new to me is that I get an annoying backslash on every backslash I type in the recent command. e.g. I first type…
1
vote
1 answer

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 back to SSH?
NecNecco
  • 701
1
vote
0 answers

CSH - if: Expression syntax error

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 format: (runscript) (commandName) (daemon # or…
0
votes
1 answer

sourcing a csh file from bash results in "syntax error: unexpected end of file"

I'm the beginner of Linux. So I have a problem when I source the file. $ source ~cupsoft/kims_setup.csh bash: setenv: command not found bash: setenv: command not found bash: setenv: command not found bash: /home/cupsoft/kims_setup.csh: line 54:…
0
votes
0 answers

csh up arrow for previous matching command

How can i configure .cshrc file to use Shift+UpArrow go through history backward search? Also, how can i configure searching cmds with same prefix? I have tried looking through .cshrc file but doesn't know what to update.
DanG
  • 1
0
votes
2 answers

csh to get difference been start and end time both inputs in hh:mm:ss format

./script.csh 05:25:00 02:30:50 should return output in mins since i am looping through the series recursively how to compare values with new large value . would | bc work in csh ?
0
votes
1 answer

How to read and replace with two arguments file in Cshell?

I'm trying to make a script what automatically replace a word in the text file. In a.v, BIRA_0 0 BIRA_1 400 BIRA_2 800 BIRA_3 C00 ... in…
Carter
  • 136
0
votes
1 answer

Accessing a field in csh

This piece of code: foreach mod ("`lsmod`") echo $mod end outputs each line of lsmod. How can I access the first field, i.e. Module, from each line? Is there any IDE forcsh or extension for vs code where I can debug csh code?
user358527
0
votes
1 answer

What does an '@' character mean in a csh script

I'm translating a csh script to bash an came across a line that looks like @ lines = `grep num_lines ../config.txt | awk '{printf("%d",int($2))}' ` What does the '@' do here? I found some documentation stating that csh uses '@' for expressions.…
1
2