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

1
vote
0answers
32 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
25 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
9 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
26 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
35 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
0answers
67 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
50 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
49 views

C Shell unfreezing using right click [closed]

I know almost nothing about Unix. I use commands like cd, rm, mkdir, cp, get, put, etc., and then simply run scripts that other people have written. I had opened C-Shell and was running a script and ...
1
vote
0answers
32 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
178 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
55 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
1answer
176 views

How to enable double tab autocompletion list in bash?

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
40 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
196 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
364 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
111 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
1k 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
106 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
89 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
156 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
43 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
85 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 ...
1
vote
1answer
913 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
105 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
1k 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 ...
1
vote
4answers
185 views

How do I run a program in a fresh shell?

I have a program that does a LOT of env manipulation. It sets PYTHONPATH and LD_LIBRARY_PATH and stuff like that. This program needs to run ANOTHER program, but in a fresh env, without all of the ...
1
vote
0answers
44 views

Properly defining a multi-line prompt in tcsh

I am trying to configure my prompt in tcsh to make it multi-line (i.e having one line provide system info, and the next line the one where I type commands). Currently I have the following: set ...
1
vote
1answer
634 views

FreeBSD csh, TAB to show available choices?

I am a newbie to FreeBSD. How can i configure csh or tcsh to show available choices by pressing TAB twice, just like bash?
1
vote
1answer
56 views

Grep expression with special file names

I have to go through some regular files in directories and find those files, that have their own name in its content. In the following piece of script is a cycle in which I am going through paths ...
1
vote
2answers
175 views

Use of find in unix on strange file/directory names

Im a beginner scripter, writing scripts in tcsh and csh (these are taught in my course). I'm writing a script which uses find for putting path of directories this is the part of the script: set list ...
1
vote
1answer
3k views

C shell script : how do I compare two strings?

I'm a C shell user. I've two files. file 1: A B C D E file 2: A C B D E I want to compare only A-A, B-C, C-B, D-D, E-E using a for loop. If the strings match, then print "match". The output ...
2
votes
2answers
398 views

setting variables inside subshell when using <<

I am using the following method in order to pass commands into a subshell that is started by "newgrp". #!/bin/csh echo "Before newgrp" /usr/bin/newgrp users <<EONG echo "hello from within ...
1
vote
2answers
345 views

Which programme calls csh.cshrc?

I understand that when a user logs into unix remotely, first a getty process is started. If authentication is successful, then etc/environement is called. However, I do not understand when is ...
1
vote
1answer
213 views

How do I start smbclient from a script in Linux?

I want to be able to quickly start smbclient to a specific directory without typing or copying it to the shell command line, but just sticking it in a script doesn't seem to work... #!/bin/csh ...
1
vote
1answer
157 views

How can I clear portion of what is typed into the prompt while working on Linux and using C-shell?

I am working in Linux and C-shell. Often times I would require to change some portion of what is there already in the prompt that I obtain from reverse searching through the history command by use of ...
1
vote
2answers
50 views

Can I see in history output from which directory I had actually issued a command?

CTRL+R allows me to reverse search through the command history which is great but can I also find out from which directory that command was run? I am using C-shell in Linux.
1
vote
2answers
172 views

enf of file unexpected (excepting “f$ing ”fi")

os: pfSense (nanobsd) shell: csh script: /etc/rc.conf_mount_rw mount -t msdosfs /dev/da0s1 /mnt/usb if ( -s /var/squid/log/access.log ) then cat /var/squid/log/access.log | perl -p -e ...
3
votes
3answers
692 views

Preventing duplicate entried in PATH (.cshrc)

I have little experience with Linux, so I will appreciate some help. I need to prepend directories to the path variable in my .cshrc file and I want to make sure that the entries are not repeated when ...
3
votes
6answers
412 views

How do I specify arguments to return all dot files, but not . and ..?

Normally dot files are not included for wildcard expansion: % echo * Applications Desktop Documents Downloads Library Movies Music Pictures Public bin If I explicitly ask for dot files, I get them: ...
1
vote
2answers
173 views

Can't remove same folder name twice

I have a folder called - bin , then I remove it by rm bin , re-create it and when I want to remove it again by rm bin the shell promts - /bin/mv: cannot move `bin/' to ...
11
votes
2answers
13k views

Difference between 2>&-, 2>/dev/null, |&, &>/dev/null and >/dev/null 2>&1

Just looking for the difference between 2>&- 2>/dev/null |& &>/dev/null >/dev/null 2>&1 and their portability with non-Bourne shells like tcsh, mksh, etc.
1
vote
1answer
201 views

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

Why would running a directory path as a command return “permission denied” and not “command not found”? [duplicate]

I am an a redhat box and I noticed that if I accidentally type in a dir path without cd in front of it, I get a /path/to/dir/: Permission denied.; however, I would expect it to say /path/to/dir/: ...
1
vote
1answer
497 views

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

“~/” receives a permission denied error in Csh

Running in Csh when using Tilde Notation performing a ~/ at the command line, I receive a "Permission denied." error. This directory is owned by the user performing the command and has the ...
1
vote
3answers
1k views

How to change shells via script?

I have to repeat following operation a lot of times, hence I want to automate it. sudo su tcsh cd $workDir Here $workDir is set in ~/.tcshrc. I tried writing two shells scripts. Script1 is temp.sh ...
2
votes
1answer
4k views

How to debug csh scripts?

My lab uses csh scripts to run jobs. It is usually difficult for me to debug a shell script, so I'm wondering if there is a csh debugger I can use. I know there are some flags like -x or -v that can ...
2
votes
1answer
1k views

Inserting a file into another file using sed

I want to insert the contents of file1 into file2 after a matching PATTERN. I want to do it only after the first occurrence of the PATTERN. I would like to know the modification I need to make to ...
4
votes
3answers
4k views

stderr redirection not working in csh

I run the following command: pkg_add emacs-23.4,2.tbz 2> output.log The output still displays in the terminal. When I press ↑, I get pkg_add emacs-23.4,2.tbz 2 > output.log with a space ...
1
vote
3answers
778 views

dircolors “missing second token”

I'd like to customize the colors of ls and as far as I understand the way to go is with dircolors. I did: dircolors > ~/.dircolors Immediately after this I launch a terminal and get this error: ...