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
2 votes
1 answer
42 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 $...
user avatar
  • 23
3 votes
1 answer
239 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/...
user avatar
  • 973
0 votes
0 answers
17 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 ...
user avatar
1 vote
2 answers
67 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 ...
user avatar
  • 371
0 votes
0 answers
42 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 ~/, ...
user avatar
2 votes
0 answers
41 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 ...
user avatar
  • 21
0 votes
0 answers
89 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 ...
user avatar
  • 1
0 votes
0 answers
32 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 ...
user avatar
0 votes
0 answers
478 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="%{\...
user avatar
0 votes
1 answer
140 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 "...
user avatar
0 votes
1 answer
116 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 ...
user avatar
0 votes
0 answers
33 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 ...
user avatar
  • 101
0 votes
1 answer
60 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[...
user avatar
0 votes
0 answers
85 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 ...
user avatar
  • 1
1 vote
1 answer
694 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 ...
user avatar
  • 63
0 votes
2 answers
210 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 <...
user avatar
  • 63
3 votes
2 answers
702 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?
user avatar
0 votes
1 answer
251 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 ...
user avatar
  • 4,121
1 vote
1 answer
140 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.
user avatar
0 votes
0 answers
67 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 ...
user avatar
1 vote
4 answers
81 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); ...
user avatar
  • 31
0 votes
1 answer
46 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 ...
user avatar
  • 423
1 vote
2 answers
242 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 ...
user avatar
  • 2,945
0 votes
1 answer
2k views

No recipient addresses found in header - Sendmail [closed]

From C shell script I am invoking a perl script to send an email, /path/send/email/email.pl "abc@gmail.com" | /usr/sbin/sendmail -t Perl script print "To: ".$ARGV[0]."\n&...
user avatar
0 votes
0 answers
32 views

How to check if the set variable has a file assigned to it with the help of if condition

#!/bin/csh -fx set my_path = "/cd/home/dir" cd $my_path set path1 = `ls -1 | grep "abc" | head -1` set path2 = `ls -1 | grep "def" | head -1` 1)#how to check if path1 ...
user avatar
-2 votes
1 answer
55 views

Communicate the data or path from .sh file to .csh

I am able to execute the .csh file from .sh file. I want to pass the path from a.sh file to b.csh file when it starts to execute the .csh file. eg:- #a.sh if(result=0) then x=path/to/.csh #I want to ...
user avatar
0 votes
2 answers
534 views

call a .csh file from .sh file

Can I call a .csh script file from .sh shell script file? For example, I have a.sh, b.csh. Can I call b.csh in a.sh file? If so, how? I have tried writing this is ash file variable= source /path/to/b....
user avatar
0 votes
2 answers
203 views

Execute a command in a separate konsole then let users type commands

I am working on software at a large corporation where I have little control over the overall technologies used, and as a result need to find solutions that will work within the constraints I have. ...
user avatar
1 vote
0 answers
25 views

I want to access one variable defined in one csh script to another csh script. How to implement in c-shell?

Script 1: #!bin/csh set option = $< switch ($option) case 1 : ... breaksw case 2 : ... breaksw endsw script 2 : #!/bin/bash Now how to access "option: variable defined in script 1 , so that ...
user avatar
  • 31
-2 votes
1 answer
37 views

I want to navigate to sub-directory where require file exist ? using CSH script

if(-f runme ) then cd `dirname $(find . -iname 'runme')` chmod +x runme source runme cd - IS THIS TRUE IN CSH SCRIPT? First it will search for runme file recursively throughout sub-...
user avatar
  • 31
1 vote
1 answer
711 views

Is there a way to disable history for one command in TCSH?

I am executing a command in TCSH, which requires me to pass a password on the command line. Obviously, I would like it not to be saved in the history file. I know that other shells like Bash supports ...
user avatar
0 votes
1 answer
139 views

why tcsh script choke on special characters inside file eg. #{ on a line is giving missing "}" error

I'm using tcsh shell script to read each line of a file input.txt script #!/bin/tcsh set out_file_length=`wc -l<$1` set i=1 while ( $i <= $out_file_length ) set each_line = `head -$i input....
user avatar
  • 1
4 votes
3 answers
166 views

Introducing a line break into a file having different columns on the basis of text in the value column

I would like to introduce a line break into a file having different columns on the basis of the value in the first column. For example: Input file: 1aa6 HETATM 4MO A 803 1aa6 HETATM SF4 A 800 1ao0 ...
user avatar
0 votes
0 answers
23 views

bjobs output not being stored properly in variable

So, I have the following script: #!/bin/bash while : do bjobs_output=$(bjobs) echo HELLO echo $bjobs_output echo WORLD sleep 1 done I am running the command in a cshell because ...
user avatar
4 votes
2 answers
790 views

"^M: Command not found" from script [duplicate]

I am trying to run the following script. #!/bin/csh # USAGE EXAMPLE: solve_mysteries.scr ops6.txt 2 # USAGE EXAMPLE: solve_mysteries.scr allops.txt 1800 set opsfile = $1 set maxtime = $2 set f = $3 ...
user avatar
0 votes
1 answer
274 views

Can't create an alias in tcsh shell when trying to sed some string with .*

I'm trying to create this alias in tcsh shell: alias repeat 'zgrep -i __NCELAB_SNAPSHO \!* | grep -v make | grep -v Flags | sed 's#CODE_COVERAGE_TYPES.*TEST_DONE=1##g'' And getting an error: alias:...
user avatar
0 votes
1 answer
8k views

Why is xterm not found in my C shell and how can I add it as I find it in TERM

I get this error: X terminal for some input / output, please make sure "xterm" command can be found in your PATH environment When I echo $TERM I get xterm. But xterm cannot be found on my ...
user avatar
  • 1
2 votes
1 answer
764 views

Without nohup on csh, background job still running after ssh exits

I'm trying to understand the need for using nohup with background commands in ssh. My shell is csh on CentOS. The background command below continues running even after ssh exits. I was expecting this ...
user avatar
1 vote
2 answers
88 views

csh to get difference been start and end time both inputs in hh:mm:ss format

./script.csh 05:25:00 02:30:50 should return output in mins since i am looping through the series recursively how to compare values with new large value . would | bc work in csh ?
user avatar
2 votes
1 answer
662 views

csh/tcsh Tab Completion with "complete = enhance" Strange Behavior

set complete = enhance is put in .cshrc, and we have two files, test_ab_dd.c and test_abc_dd.c. If I type test_ab_<TAB> in the command line, csh DOES NOT autocomplete to test_ab_dd.c. It ...
user avatar
0 votes
1 answer
35 views

file name matching

I have 2 folders with number of files with a pattern of File-1 1234_-_abcdef_abcdefg.abc File-2 1234_-_qwerty_abcdefg.abc My code goes like foreach d (`cat deck_list`) foreach c (`cat cars_list`...
user avatar
0 votes
1 answer
36 views

How to read and replace with two arguments file in Cshell?

I'm trying to make a script what automatically replace a word in the text file. In a.v, BIRA_0 0 BIRA_1 400 BIRA_2 800 BIRA_3 C00 ... in b.v, BIRA_0[25:0] BIRA_0[95:26] BIRA_0[125:96]...
user avatar
  • 135
0 votes
1 answer
459 views

Validate the user input against a specific pattern BASH

if ($input !~ [[:upper:-]][[:digit:]][[:digit:]][[:digit:-]][[:digit:]][[:digit:]][[:digit:]]) then goto error1 else echo $input endif I have tried the above code to match the pattern "P-70-90" ...
user avatar
0 votes
0 answers
193 views

Find and print permissions command in a csh file

Trying to create a .csh file that can find and display permission of the files in the directory. Using the following content of the script #!/bin/csh -b find . type -f \( -name "*.sh" -o -name "*....
user avatar
  • 1
0 votes
0 answers
496 views

pipe into if then in csh/tcsh

I would like to have a csh script to test a variable between two pipes. For example (the incoming resembles a json file but without the newlines and indentations): set debug = 1 cat test.inp | if ($...
user avatar
2 votes
3 answers
2k views

How can I dynamically change a path in my aliases?

I have a bunch of aliases in my .cshrc file which use the path: /projects/project_name/my_name/$CLIENT I've written a short script which is intended to take a folder name from my working directory ...
user avatar
  • 121
0 votes
1 answer
150 views

Which of the following commands created a bash subshell

Which of the following commands created a bash subshell? bash bsh csh None of the above This question asked in recent exam and i was unable to answer. Can any one give me right ...
user avatar
1 vote
1 answer
470 views

How to use if on csh FreeBSD from test if file is older then X minutes

I have the following code working in Debian system's: for File in "${Files[@]}"; do if test "`find $FolderDownload/$File -cmin -190`" ; then echo "File is new then 3 hours" # Set ...
user avatar
  • 23
1 vote
3 answers
161 views

How can I give new file names while a program is working in a loop in cshell?

I have lots of .dat file and I want to convert them to .sac file (a type of seismogram file). I convert files with xy2sac program (I didn't write the code), but I have to give converted files a new ...
user avatar
  • 61
3 votes
1 answer
209 views

What is the use of `!#` in csh, bash, zsh and probably other shells?

From man bash: !# The entire command line typed so far. From man zshall: !# Refer to the current command line typed in so far. The line is treated as if it were complete up to and ...
user avatar

1
2 3 4 5 6