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

2
votes
2answers
51 views

Event not found in sed call in csh script

I tried the code as given on delete text between curly brackets however I am facing this different error regarding event in sed. file contains: This is { {the multiline text} file } that wants { ...
0
votes
1answer
18 views

Declaring User-Defined variables in the C shell in UNIX read-only

I'm having trouble finding documentation, but what is the command to make a user defined variable in the c shell read-only in unix?
3
votes
0answers
28 views

parametric aliases in csh to add export command

I'm trying to find a way to translate functions to csh/tcsh aliases, since they lack functions but have parametric aliases. As a first step I'm trying to create an export command. Here's what I've ...
4
votes
1answer
48 views

Are there problems with hyphens in functions, aliases, and executables?

In my testing (in Bash and Z Shell), I saw no problems with defining functions or aliases or executable shell scripts which have hyphens in the name, but I'm not confident that this will be okay in ...
1
vote
2answers
45 views

C Shell: different actions depending on the file type

I very new to C Shell. I am trying to read a file from the command line, and determine whether it's a zip file, a .txt, a symbloic link, a pipe, or whatever ("unknown"). Then I'd like to execute a ...
4
votes
4answers
369 views

Text files containing their own name

I need to find in certain directory and all its' subdirectories all text files that contain their own name. How do I do this? (preferably without awk command)
1
vote
1answer
23 views

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 ...
1
vote
0answers
33 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
103 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
11 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
35 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
78 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
125 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
81 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
52 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
37 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
185 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
59 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
315 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
41 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
209 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
716 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
139 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
2k 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
165 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
110 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
174 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
48 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
95 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 ...
2
votes
1answer
1k 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
116 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 ...
2
votes
4answers
217 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
58 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
967 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
58 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
216 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
485 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
455 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
237 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
182 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
232 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
818 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
517 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
185 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 ...
17
votes
2answers
16k 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
231 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
95 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/: ...