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.
287
questions
0
votes
1
answer
30
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
58
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
0
answers
17
views
Changing variables inside a csh script [duplicate]
I have a csh script and I have to callenter code here bash script that changes the value of an environment variable, like this:
changevar file:
#!/usr/bin/bash
export FFF=0
beforevar.csh file
#!/bin/...
0
votes
2
answers
115
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
33
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
45
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
115
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
101
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
110
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
194
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
137
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
548
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
27
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)))
2
votes
1
answer
75
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. ...
0
votes
0
answers
113
views
tcsh way of pattern substitution
I am using tcsh shell with Jenkins. In short, the matching suffix should be removed from the output.
Achieved in bash with the following.
cd ${WORKSPACE%${JOB_NAME}}
Case:
Given the following ...
0
votes
1
answer
229
views
comprehensive csh to bash translation [closed]
Is there a comprehensive dictionary to translate csh -> bash? I find many questions and answers which give piecemeal answers, but I'd like a comprehensive dictionary. I do understand that word ...
2
votes
2
answers
364
views
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 ...
0
votes
0
answers
42
views
Last login command, alias in csh
In the C shell, how can we display the login history of a particular user using an alias in such a way that the user only enters the alias name and the number of lines to be displayed without typing ...
0
votes
0
answers
266
views
recursive history search for tcsh shell
In bash shell, i generally use CTRL+R to fuzzy search a command that i executed recently.
However the same doesn't seem to work for tcsh or csh shells.
I want to understand if/how to do the same ...
0
votes
0
answers
69
views
need to compare 3 variables and need to print highest of those three variables
set func_ssgnp_0p675v_m40c_typical_Ccworst_R2R_WNS = `grep -i Reg2Reg $tile/../sta/func/sta-max-func-ssgnp_0p675v_m40c_typical_Ccworst/reports/pba_proc_qor.rpt | awk '{print $2}'`
set ...
0
votes
1
answer
640
views
How to pass a variable to a sed command in a csh script?
Unix & Sed noob here!
I have a requirement where I need to put a suffix ",waive" in case a line in a report containing a matching string.The matching string is part of another file "...
1
vote
1
answer
416
views
How can correct these lines of sh script to avoid "syntax error: unexpected end of file"
#!/bin/sh
init=step5_input
rest_prefix=step5_input
mini_prefix=step6.0_minimization
equi_prefix=step6.%d_equilibration
prod_prefix=step7_production
prod_step=step7
# Minimization
gmx grompp -f ${...
0
votes
0
answers
58
views
How to store multiple files in an array
I am using the split command in cshell to split a file into smaller files. Since the split command names the output files xaa,xab,xac.... i have to rename them. I want to store the split commands ...
1
vote
2
answers
1k
views
while command not working when bash script is sourced in tcsh?
I had made a bash shell script which include while command but when I run the script using source command on terminal, it gives a syntax error message.
I need to use source because I have to set the ...
-3
votes
2
answers
291
views
I'm using bash on Debian 11. But how may I open a Bourne, Korn or C-Shell if I am willing to?
I am reading a book speaking about Bourne Shell (the ancestor of bash = Bourne-Again Shell I'm currently using), Korn Shell and C-Shell.
I was curious, and willing to experience them.
On a bash ...
0
votes
1
answer
734
views
How to source a script code (set a variable) from another shell?
I tried to use FreeBSD.
The FreeBSD root user uses csh by default.
user@freebsd-13:~ $ echo $SHELL
/bin/csh
I know that setting a variable via $() does not work in csh.
root@freebsd-13:~ # export ...
0
votes
0
answers
57
views
ssh session exits when cd command fails
I connect to a remote host using ssh. After connecting, if a cd command fails like below, my ssh connection exits right away. How can I prevent this from happening?
scott@mac % ssh remotehost
Last ...
2
votes
1
answer
683
views
In tcsh, how can I keep '{' '}' in assigning a variable?
I am making a simple shell script using the tcsh shell.
I assigned a variable as a command to use later.
But brackets within single quotes disappear.
set aaa = "test '10' '{}' ' " ; echo $...
4
votes
1
answer
956
views
Use the parent directory from the symlink instead of where the directory actually resides on the filesystem
So let's set up the context. Two paths:
/some/very/convoluted/path/name/the-wanted-directory
/myhome
I create a symbolic link in /myhome and then cd into it:
/myhome $ ln -s /some/very/convoluted/path/...
0
votes
0
answers
205
views
using 2 alias together in cshell terminal
lets say I have 2 aliases, each having multiple arguments.
It looks somewhat like below example
alias s1 "command1 -a -b -c"
alias s2 "command2 -d -e -f"
now if I run :s1 s2 in ...
1
vote
2
answers
125
views
how to create a csh script that can identify the correct USB disk where I have saved my virtual machines
I'm running Freebsd 13R and as shell I'm using csh. I would like to create a script,that looks the presence of the word "r1w1e2" or "NM13N4CZ" or "3e4d31334e34435a" when ...
0
votes
1
answer
928
views
How to open current path when creating a new tab in gnome terminal when using csh shell?
I'm on CentOS 7.9 (Gnome Terminal 3.28.2) with csh (yeah I know but work requirement) as my default shell. My problem is this: whenever I open a new tab in gnome terminal, the new tab redirects to ~/, ...
2
votes
0
answers
983
views
Sync terminal history in c shell
For work, I remote into a linux server that uses c shell rather than bash using Remote Desktop. While in session (lets call it session 1) I'll open up many tabs in a given terminal and type commands ...
0
votes
1
answer
484
views
Behaviour of single and double quotes depending on shell
I've been scratching my head for quite some time with this....
Inspired by this answer, I'm trying to run 'ack' and to find either a single quote or a double quote in source files.
Doing this in bash ...
0
votes
0
answers
64
views
Replacement in file using bash
I'm trying to translate (a pretty lengthy) script from csh to bash. It takes a 'Makefile' and performs the commands:
cpp_begin_line=`grep -n cpp_flags Makefile | sed 's/:/ /' `
cpp_end_line=`grep -n ...
0
votes
0
answers
3k
views
C-shell prompt color
I wan to change the color of my csh shell. I've edited my .cshrc file, following the instruction I've found here, and included this in it:
set yellow="%{\033[1;33m%}"
set end="%{\...
0
votes
1
answer
339
views
TCSH: 'Can't find string terminator' Error From perl -e in TCSH Script
I'm seeing this error from my tcsh script and I can't figure out why.
Script:
#!/usr/bin/env tcsh
foreach n (0 1)
set PERL_CMD = "perl -e 'print qq^RUNNING^; exit ${n} '"
echo "...
0
votes
1
answer
928
views
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
...
0
votes
0
answers
92
views
How can I prevent standard output from displaying as a standard error in csh or tcsh?
When executing a process in the background using '&', the standard output goes to standard error. This happens if an error is detected in the standard error output when executing a command, or if ...
0
votes
1
answer
224
views
How to unbold my tcsh prompt (my tcsh prompt is stuck bold)?
Unlike most searches I did on this question, I want my prompt to not be bold. But I can't stop it.
Here is how I set my prompt.
set green = "%{\033[01;32m%}"
set white = "%{\033[...
0
votes
0
answers
409
views
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 ...
3
votes
1
answer
3k
views
Using single quotes inside input of heredocs
I need some help debugging my tcsh script. It uses heredocs. The code:
<pre_setup> <<EOF1
<setup> <<EOF2
<command>
exit 0
EOF2
exit 0
EOF1
The <pre_setup> is ...
0
votes
2
answers
953
views
What does it mean <<EOF in (t)csh?
I have the following command:
wash -n <groups> <<EOF
echo hi
echo bye <<BYE
<commands>
exit 0
BYE
exit 0
EOF
<commands>
where <groups> are some groups and <...
3
votes
2
answers
4k
views
How to reload aliases added in ~/.cshrc without reboot FreeBSD 11.3
As the title states, how to reload aliases added in ~/.cshrc without rebooting FreeBSD 11.3?
0
votes
1
answer
763
views
running cshrc script in RHEL 7 from bash account does not work
I was given a software suite which is based around cshrc.
Such that a user is supposed to source a setup.cshrc file and within that it sources numerous other .cshrc scripts to set up the environment ...
1
vote
1
answer
701
views
How can I get my csh alias to work in bash?
This alias works fine in /bin/csh but not in /bin/bash:
alias cd='chdir !* && setprompt; clear; ls -F'
Basically, I would like to cd to any directory and ls in color.
1
vote
0
answers
596
views
How to know what commands are run or what script is sourced when a new terminal is opened?
When I open a new terminal, directory is changed to some path (not in my .cshrc). I want to know from where does this come from.
Is there a way to know what commands are run or what script is sourced ...
1
vote
4
answers
268
views
How to extract a word that occurs between two keywords on a line? [duplicate]
Suppose I have a code mentioned below.
module dut#(parameter type tp =int, tp x = 12 ) (int r , reg [7:0] rg);
endmodule
module mid (int r, reg [7:0] rg);
endmodule
module bin (int z, logix s);
...
0
votes
1
answer
233
views
xterm is calling .cshrc twice
I'm running ubuntu 18.04, I've asked this question on askubuntu, but got no response, so I thought I'd ask on a different forum, hoping for a different readership. I do know that the same problem ...
1
vote
2
answers
1k
views
what is the csh equivalent of set -xv?
I have a rather long csh script that doesnt work, or doesnt work properly. in bash I would do set -xv to get verbose logging. what can I do in cshell? I tried adding set -xv it complained that - isnt ...