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
0
votes
2answers
53 views

How to split and access fields delimited by colon?

This piece of code: foreach line (`cat /etc/group`) echo $line end returns line containing 4 fields delimited by :. How to split fields and access the first field of each line?
0
votes
1answer
25 views

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 ...
1
vote
1answer
41 views

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 ...
0
votes
1answer
28 views

csh: Changing path in non-interactive login

I want this: $ ssh nopathcsh@lo 'echo $path' /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games To return this: /usr/bin /bin I have tried changing and ...
1
vote
2answers
55 views

Why is SHELL pointed to /bin/sh in a Csh script?

Yes, I know C-shell is bad. No, I did not choose C-shell. Yes, I would prefer to use a proper shell. No, I cannot switch to a better shell. I have a very simplistic script: /tmp/env_test.csh #!/...
3
votes
1answer
38 views

How to use here document or assign multiline string to variable in csh?

I want to assign to variable to a multi-line string that contains a variable and then echo it. I attempted using here-doc as shown below. What is the best way to achieve this in csh? set my_name="...
0
votes
1answer
59 views

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 ...
1
vote
2answers
39 views

Why can't tcsh do a single-line 'which -> vim' command?

I often have to do which command, and then open it in vim to actually see what's inside. I'd like to have an alias or function that does this, with tab completion. Here's what I've tried: superwhich()...
0
votes
1answer
83 views

How to customize .cshrc to configure command prompt?

Background Inspired by this question, I wanted to try to change my command prompt in this manner Enter this line into ~/.cshrc a. setenv PS1 "\[\e[32m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]\[\e[33m\]@\[\e[...
0
votes
0answers
34 views

Add trailing slash in csh

How do I get csh to add a trailing slash at the end of tab autocompletion? eg: \stuff \otherstuff now if I type cd s and press tab, I get: \stuff and not \stuff\
0
votes
2answers
69 views

Comparing 2 files using awk , not getting any results - C shell

I am using c shell and trying to compare 2 files using awk . But the below awk statement doesnt give any result. Need to acheive this solution in awk using C shell. awk 'FNR==NR{a[$0]++;next} { {...
0
votes
1answer
47 views

Ambiguous error while executing ksh file

I have created a audit.ksh file which is used to clear old "*.aud" files. But when i run this file am getting below error. The strange thing is the commands inside the file works fine while executing ...
0
votes
1answer
51 views

error while using sed in tcsh alias

I am unable to "source/run" my tcsh alias, which is as below: alias inp1 "grep -i "final_model" /scr/cb2TempProd/tmp/$USER/\!:1/Simulation/Input/assemble.preprocessing | sed 's#.*<##; s/>$//'" ...
0
votes
2answers
84 views

How to retrieve prompt format string in csh / tcsh

My current prompt format string is generated by an outside script that is provided by the organization. I want to manipulate it a bit (add time to the string) for that I need my current format string. ...
0
votes
0answers
50 views

How to execute unix command after few background jobs?

My c-shell code has to complete few concurrent background jobs before execution of some unix commands. However, somehow in code my background jobs never returns handle to unix commands. i.e. $cmd1 | ...
1
vote
0answers
67 views

Linking issues with leptonica and libpng

Working through an install of tesseract without sudo permissions and without a standard bevy of prebuilt libraries. The installation I've got to go through as far as I know follows the path of zlib -> ...
1
vote
1answer
172 views

How do I cd and then ls in my cshrc

I want to be able to cd into a path and have it ls automatically. I have tried doing a function such as cs() { cd "@a" ; ls} but this results in an error saying "badly placed ()" so I do not think I ...
-2
votes
1answer
91 views

Linux (shell script) csh

I have a code that contain this line: set file = "" #empty what does it mean?
0
votes
1answer
402 views

C-Shell : variable in variable

I want the value of variabe ${var}_err_num, but i can't do it. #!/bin/csh -f set list = "book bus apple" foeach var $list set err_num * * @err_num = $err_num + 1 set ${var}_err_num = $...
0
votes
3answers
63 views

CentOS and Switching Unix Shells

I am using a VMWare Virtual Machine with CentOS installed. I am using BASH shell now but need to run an application that requires C Shell. Can a person just switch shells ? Will you need to ...
0
votes
1answer
43 views

umask does not have -S option

I'm trying to use umask -S to show the current mask in symbolic form (per man umask on my system, which gives me the page BASH_BUILTINS(1)). But umask doesn't seem to behave as the manpage claims: ...
1
vote
0answers
175 views

Convert date in this format to second [closed]

I need to determine when was the last login time from some login times i have. So! I have the date in this format : month as in Oct Sep Jan etc. then follows the day in numeric form 22, 23, 1... and ...
2
votes
1answer
435 views

OpenBSD - How does one set an alias?

I am running the latest OpenBSD and I cannot figure out how to set a simple alias, something along the lines of cls=clear. I've tried putting it in ~/.cshrc and in ~/.profile. I've tried: alias cls ...
0
votes
1answer
203 views

for loop logic porting from bash to csh

I have below code snippet working in bash: for i in `ps -eaf | grep -i <pattern> | awk '{print $3}'`; do kill -9 $i; done But I have a requirement to port this code to work in csh shell due to ...
1
vote
1answer
89 views

Program installation: Csh to Bash

I am trying to install xscore v1.3 (XSCORE MANUAL). They provide instructions to set up some environmental variables in the .cshrc file under C-shell. setenv XTOOL_HOME ...
1
vote
1answer
216 views

FreeBSD: Is the default user shell `tcsh`?

I was recently reading a tutorial for tcsh and it said that the default user shell for FreeBSD was tcsh and I was surprised. For FreeBSD, is the default user shell tcsh?
-1
votes
2answers
497 views

csh if statement interactive use

Either there's something fishy with my Solaris 10 csh implementation of if statement or I don't get something right (of course the second is very well probable in my case at least) but when I do: % ...
1
vote
0answers
34 views

How to automatically record all your terminal sessions with script utility using .cshrc [closed]

I have the exact same question previously asked here: How to automatically record all your terminal sessions with script utility But instead of using bash and .bashrc how would I write this in ....
-1
votes
1answer
56 views

How to check every file in directory and ask the user to do action in csh shell

The actions I would like to do with this script is to Read the name (without base) of each file in a directory For each file, ask the user if he wants to perform an action (e.g. move the file in a ...
0
votes
2answers
46 views

Directory tree listing, script does not work in csh?

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' I found a command to display directory tree (see above), it didn't work correctly. It gave error message "...
1
vote
1answer
190 views

user resources csh.login restrictions

I need to fix a vulnerability in a RedHat 6 server: File /etc/csh.login must exist, and must trigger an invocation of source /etc/profile.d/IBMsinit.sh. I verified file csh.login is in /etc, but I ...
-2
votes
1answer
115 views

Why will “0.0u 0.0s 0:00.00 0.0% 0+0k 0+0io 0pf+0w” display on screen in csh [closed]

friends, I don't know why "0.0u 0.0s 0:00.00 0.0% 0+0k 0+0io 0pf+0w" (and many lines like this) will display when I run some C shell script, but not when some others run. And I never encountered with ...
0
votes
3answers
2k views

How to change timezone in current shell session in Redhat

ls -lt shows time in PDT, I want to change it to Asia/Singapore in the current session. I tried set TZ=Asia/Singapore But it's showing the same time on ls -lt. How to do it?
0
votes
0answers
60 views

cshell text editor

Is there any text editor with highighting for cshell scripts that includes code folding? (Preferable something with a less steep learning curve than vim and emacs) I haven't been able to find ...
1
vote
3answers
235 views

get average for all numbers with irregular columns

all Can Awk deal with irregular columns? i.e. I have a file like below, each columns may have different number of values, how to get the average of all the positive values? Please note, the ...
0
votes
1answer
1k views

csh - check if $PATH variable contains a substring

Maybe I'm thinking about this wrong, but I want to add Python to my $PATH variable if it isn't already in there. Here's my code # Add Python to $PATH if(-e /path/to/python/bin && (! $PATH....
1
vote
1answer
112 views

How to avoid 'ambigous redirect' when executing command over ssh

I'm trying to execute a script on a remote server via ssh. the command should go to the background and continue to run after logout. The result of the command should be redireced to out.log on the ...
1
vote
1answer
1k views

export: command not found

I'm trying to install GAMESS (a computational chemistry package) on a Linux Mint machine and the config file has a #!/bin/csh at the beginning. When I run ./config the first line is export: Command ...
0
votes
1answer
374 views

sourcing csh script does not set the path variable without Bad subtitute

I am writing a simple script to source path variable as below: #!/bin/csh echo "setting path" set path=($path /sbin:/mscc/apps) However, the path variable does not change and remain the same. The ...
0
votes
1answer
1k views

read each line one at a time in csh

In bash, code like this will read each line in a file one at a time: while IFS=$'\r' read -r line || [[ -n "$line" ]]; do something done < "to-read-file" When the code is running, as long as ...
0
votes
1answer
82 views

How to force csh use local bin? [duplicate]

I'm only able to install new tool in my local directory. After ./configure --prefix=/local/directory, new tool is installed my local bin. But by default it's still point to the old version. How to ...
0
votes
1answer
85 views

Advanced aliasing for csh shell [closed]

I want to create an alias for the nedit command but with the ability to add a .txt automatically to the passed argument. For example, when I would type n newfile --> it should execute --> nedit ...
2
votes
3answers
4k views

Convert value from scientific notation to decimal in shell?

How to convert value from scientific notation to decimal in shell? (preferred C shell) Also I'd want to convert it from e-12 to e-9 and then shell 42.53e-12 to 0.04253. I have to do this for a list.
1
vote
1answer
52 views

Issues setting a variable to a string containing metacharacters, find, and another variable in csh

I'm using csh for a project (forced into it, sorry), and one component of my script uses variations of the following in a large block of its functionality: find . -maxdepth 1 -not -type d | awk '{...
0
votes
1answer
45 views

How to stop csh set from removing braces inside single quotes?

In the following code, it seems that {} are removed from inside single quotes when using set but not when using alias. How can I stop set from removing the braces? set variable = "middle" set string =...
1
vote
1answer
1k views

Login via ssh does not source the .cshrc file in my home directory (MobaXTerm Professional)

During my login to my Linux environment via ssh the .cshrc file in my home directory is not read. Each time I had to read this file after login via source ~/.cshrc I use MobaXTerm Professional 10.5 ...
1
vote
1answer
66 views

Creating a 'sub-screen', similar to how watch behaves [duplicate]

I have a Python script which generates a lot of different text outputs that require me to clear the screen quite regularly. The problem with this is that once the script is finished, I have a terminal ...
0
votes
2answers
152 views

Run command from history with parameters

Whenever I need to type a long command I find that the exclamation mark to refer to history very handy. For example, !ssh can be used to invoke the last ssh command I used. However I cannot get it to ...
1
vote
0answers
47 views

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 ...
0
votes
1answer
3k views

How to change Bash to csh with username and password

I want to change bash to csh I'm using following command which is not working chsh -s /bin/csh insite(user) insite(password). I need to write shell script with this command this is the output i got ...