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.
288 questions
1
vote
1
answer
95
views
How to define a recursive alias in csh (intentionally!)
It is known that attempting to invoke a custom alias inside itself (be it directly; or indirectly via intermediate aliases that call each other) would cause an "Alias loop." error, and ...
18
votes
2
answers
2k
views
What exactly is a scratch file (starting with #)? Does it still work today?
I've been reading up on some Unix history and got interested into the csh because it's installed by default on OpenBSD.
In the csh manpage it had a reference to "W Joy - An Introduction to the C ...
0
votes
1
answer
153
views
cleartool command not found from .cshrc but found when manually called
I'm having an issue with cleartool commands called from my .tcshrc. I try to call cleartool setview, but get a cleartool: Command not found error. however, when I call the command from the terminal, ...
0
votes
2
answers
97
views
Find files created after a particular time in csh on SunOS
On my SunOS system, I'm trying to find all files created after 7 PM using csh, ls, and awk.
ls -l "${Source_files_Dir}"/*.zip| awk -v today="$(date "+%b %d")" '{
date=$6&...
0
votes
2
answers
158
views
Load files in sequential order
I need to load multiple files in my shell script with the same filename but appended in the front of each file name is YYMMDDPERSONNEL
Examples: 231102PERSONNEL and 230103PERSONNEL
There are many ...
0
votes
0
answers
58
views
Substitute square bus in csh script
I have input list: adr[0] adr[1] xadr[0]
I want my output is: adr[*] adr[*] xadr[*]
#! /bin/csh -fv
set list = "adr[0] adr[1] xadr[2]"
foreach f (${list})
set f_tmp = `echo "$f&...
0
votes
1
answer
68
views
How can wildcard expansion create duplicates?
I have a directory with an absurd number of files, which makes this nigh impossible to understand by inspection. But here's the situation:
cp giant_folder/pre* myfolder
It's crunching along and ...
0
votes
1
answer
182
views
C-Shell - stripping wildcards from user input
I am trying to strip wildcards from user input text in a c-shell script.
I realize that the shell automatically expands all wildcards prior to storing the data.
Is there a way to isolate the non-...
0
votes
1
answer
320
views
Calling a script from within csh with output redirection
What I would want:
#!/bin/csh
# call /myscriptpath/myscript.any and redirect 2>&1 and get retval and output
set my_msg = `/myscriptpath/myscript.any`
set my_ret = `echo $?`
How to capture the ...
0
votes
1
answer
255
views
When logging into a UNIX/Linux box, which profile scripts are executed?
When logging into a UNIX/Linux box, which profile scripts are executed?
Typically there are several different profile scripts that set the $PATH variable and other aspects of the user's environment. ...
2
votes
1
answer
314
views
What does \!^ in csh alias do
Note: my shell is csh
An ex-co-worker gave me the following command to put in my .cshrc:
alias bastion 'ssh -L \!^\:<some_ip_address> <username>@<something.com>'
Note that what is in ...
0
votes
0
answers
244
views
Why do I get "Not a terminal" error during output redirection in csh?
Background:
We have put some command outputs (both stdout and stderr) into the same file under the csh shell.
Question:
Why do we get the "Not a terminal" message in the following ...
1
vote
1
answer
1k
views
/etc/passwd shows bash SHELL, but my terminal starts up in csh
I'm trying to determine what is setting the shell to csh when open a terminal and log in.
From the information I've read, the default shell is set in /etc/passwd, and I see an entry in the /etc/passwd ...
0
votes
1
answer
47
views
tcsh equivalent of bash command (deleting all but 10 most recently modified directoies)
Below keeps latest 10 directories and delete the rest. Works fine with bash.
What would be TCSH equivalent to bash below?
keep = 10
rm -r $(ls -dt */ | tail -n +$((keep+1)))
3
votes
1
answer
107
views
Alias + and - in zsh?
For years I've used + and - as aliases for pushd and popd in both csh and bash. I've finally given up on my Macs and want to switch to zsh but I haven't been able to find a way to make these aliases. ...