Questions tagged [csh]

csh, or the C shell, is a command interpreter with a syntax reminiscent of the C programming language.

csh
Filter by
Sorted by
Tagged with
0 votes
1 answer
3k views

Cannot source script in .cshrc

A library I'm using has a script to set the appropriate environment variables: # Source this script to set up the ROOT build that this script is part of. # # Conveniently an alias like this can be ...
smead's user avatar
  • 175
0 votes
1 answer
1k views

copy a file to an existing directory but says directory doesnt exit

i am tryign to copy a file from one directoy that i am to a directory that already exists but the terminal gives me an error saying that it cannot create the file and that it does not exist cp ...
rambokayambo's user avatar
0 votes
1 answer
63 views

Quotes around $VARIABLE?

What does a line of code like this do? if ("$MY_VARIABLE" == "some_string") ... Is that just how csh interprets variables as strings for comparison and assignment?
JDS's user avatar
  • 16.6k
0 votes
1 answer
1k views

Getting stdout+stderr in a log file

I am trying to implement something which my logic says can't be done. But I need your help to understand why can't it be. Short Version of Question Is it possible to log stdout+stderr of a script in ...
Ani's user avatar
  • 968
0 votes
1 answer
790 views

What does the -b argument do in csh?

I am looking at a tcsh script that has the following shebang line: #!/bin/tcsh -fb # then executes some commands What does the -b do? From the man page: -b Forces a ''break'' from option ...
andrewrjones's user avatar
  • 1,831
0 votes
1 answer
4k views

sort strings in csh

set abc=( x1 y1 x2 y2 x21 y21 x22 y22 ) set new=`echo $abc | sort -kn` echo $new The above script gives me the same array. I expect x1 x2 x21 x22 y1 y2 y21 y22 Where did I go wrong ?
user691197's user avatar
0 votes
3 answers
11k views

How to extract a string in csh?

I would like to extract a string as below: setenv VARIABLE /opt/Application/File/Version22 I want to display only File/Version22 on screen. It means /opt/Application/ is always the prefix. I want ...
alwbtc's user avatar
  • 28.9k
0 votes
2 answers
531 views

How to create an alias that can substitute arguments for C shell?

I need to use the following very often diff <filename.c> standard How can I have an alias (adiff) for it so that I would do adiff filename.c and it would expand to diff filename.c standard
Lazer's user avatar
  • 92.5k
0 votes
4 answers
820 views

problems with cut (unix)

I've got strange problem with cut I wrote script, there I have row: ... | cut -d" " -f3,4 >! out cut recieves this data (I checked it with echo) James James ...
lego69's user avatar
  • 817
0 votes
2 answers
102 views

strange behavior

I wrote simple script test echo hello #<-- inside test if I press one time enter after hello, my script will run, if I don't press - it will not, if two times I'll receive my hello and + command ...
lego69's user avatar
  • 817
0 votes
2 answers
3k views

csh script inherit envirionment variables?

I found an odd problem when I run a simple csh script on Solaris. #!/bin/csh echo $LD_LIBRARY_PATH Let's call this script test. When I run this: shell> echo $LD_LIBRARY_PATH shell> /usr/lib:/...
solotim's user avatar
  • 1,826
0 votes
1 answer
182 views

Remove symbol in shell

I'm new to shell scripting, right now using csh and let's say I have a line in my configuration file like this: 127.0.0.1:2222 127.0.0.2:3333 127.0.0.3:4444 All I want is to parse it for two ...
Ebbcom's user avatar
  • 1
0 votes
1 answer
2k views

evaluating environment variable from file in csh

I have a config file that contains the following line: pre_args='$REGION','xyz',3 Using perl from within a csh script I can evaluate environment variable $REGION like so: set pre_args = `grep -v '^#...
richard's user avatar
  • 75
0 votes
2 answers
593 views

csh list of commands like ksh { list; }

In bourne-compatible shells, the { list; } syntax causes the complete list of commands to be read by the shell before executing it, without opening a new shell. Is there anything similar for the csh? ...
andreas buykx's user avatar
0 votes
1 answer
33 views

Login to a new machine and run the rest of csh script in that new machine

I have a linux csh code. I need to run part of the code in another virtual machine. How can I do that? My code has following steps echo $PWD rsh mkdir NEW cd NEW echo $PWD Logout from new machine cd ...
amare ghn's user avatar
0 votes
1 answer
91 views

Linux, C-shell, save Awk string output to a variable and preserve special characters in string

I have a csv file with string data. The string, 1000/06{a-09}90.log, is in row 236 and column 6. I tried to save the string in a variable using the command below. This command doesn't preserve the ...
Devin's user avatar
  • 1
0 votes
1 answer
156 views

Having a multi line if condition inside a flock command in a Makefile target

I have that following target in my Makefile target: config mkdir -p results; \ cd results; \ flock . -c ' if ( ! -f "FINISHED_build" ) \ ln -s $(OUTDIR) output ; \ ...
Merolla's user avatar
  • 315
0 votes
1 answer
145 views

Set csh prompt to raw output of a command with multiple lines and special characters?

I am trying to set my csh prompt to the raw output of a particular command. I know how to do that for simple outputs; for example: set prompt=`echo propmt%|sed "s/pm/mp/"` ... results in a ...
Bob Vesterman's user avatar
0 votes
1 answer
129 views

What is the csh/tcsh equivalent of set -u in bash?

csh/tcsh by default exits with error on undefined variables. I want to suppress that behavior for a piece of code just like bash does with set +u. Is there a way to do that?
danny's user avatar
  • 1,181
0 votes
1 answer
42 views

How to replace a line in a file containing a $ sign with a value input from user using sed

I have a file with a value for a variable being used which I want to substitute with a value input from the user. I tried the below sed -i "s/^\$var.*/\$var = \"$uval\" ;/g" file ...
John's user avatar
  • 3
0 votes
1 answer
321 views

Jenkins Pipeline Groovy script tcsh alias expansion

I have a legacy project in Jenkins that hast to be pipelined (for later parallelization), hence moving from simple tcsh script to pipeline running the script as #!/bin/tcsh source ./mysetting.sh ...
ridewithstyle's user avatar
0 votes
1 answer
53 views

How to sort number in file (highest)

There is a file included many information. I want to sort several sentences with included numbers. In Files, there are several sentences. There are 7 lines below (middle line is blank) GRELUP.C.3a.or:...
yamusinx's user avatar
0 votes
1 answer
345 views

How to grep a pattern in an array using CSH script

I am working in CSH script and i am new to this script. My requirement is to grep a pattern in an array. I am able to get the same using bash but unable in CSH. Could you please help me this. Bash ...
varun kumar's user avatar
0 votes
2 answers
364 views

cshrc not getting sourced after installing miniconda

Hope this is an easy one for somebody: After installing miniconda on mac, my ~/.cshrc file no longer gets sourced when running a new shell. The system-wide cshrc is getting sourced from /etc/csh....
superlazy's user avatar
  • 727
0 votes
2 answers
37 views

up line that start with specifc string

How can I take line up if string start with a specific word? file: My name is kuku My name is pupu My name is yoyo Output should be: My name is kuku My name is pupu My name is yoyo I tried the below ...
user3835935's user avatar
0 votes
1 answer
129 views

Merging *.fods using xsltproc to generate worbook with multiple sheets

I have several excel worksheets in unix environment. My goal is to merge them into one single workbook in unix environment itself. I found a found solution using xsltproc which sort of works, but ...
avr's user avatar
  • 21
0 votes
1 answer
893 views

Bad : modifier in $ ($)

I have written small script and getting bad mofied error. not able to figure out what i am missing here. the cth_pythonpath variable exist into environment and able to print variable #!/bin/csh -f ...
user765443's user avatar
  • 1,874
0 votes
1 answer
176 views

How can I ignore first line and read and store values from second line of text file in csh script

I have a text file in which data is stored in this format- Sample|Name|Date|Value1|Value2|Value3 Example|shell|20210825|1400.67|1456.98|1234.56 Now I want to print the values only from this text file ...
Saurabh's user avatar
0 votes
1 answer
41 views

A strange error in shell script while combining two string variables

I will post my script here #!/bin/tcsh echo 'Running' set fileN = '2021-02-07-0448-04S.JKH_RR.SAC' set fileE = '2021-02-07-0448-04S.JKH_RR_BHE.SAC' set compR=BHR set compT=BHT set compR_name=BHR.SAC ...
vgb_backup's user avatar
0 votes
1 answer
174 views

How to attach csv in mutt command using C shell

Below is the code I tried with html body with out attaching csv file. It is working fine #!/bin/csh mutt -e "set content_type=text/html" -s "status report on" [email protected] < ...
Rama's user avatar
  • 175
0 votes
1 answer
386 views

I am unable to type cast string to integer in csh

I want to fetch out '-0.5' from the file example.txt and add 1 to it. Although I am able to fetch out '-0.5'. but I am unable to add 1 to it, maybe because -0.5 is considered as a string and not a ...
Insuzu's user avatar
  • 19
0 votes
3 answers
380 views

trying to grep file paths from pipe output

I need to find the file paths in perforce which are not following some standard we following. Basically, Our standard way to add new file in perforce path :- //depot/project/name/content/<...
Ramse's user avatar
  • 144
0 votes
2 answers
305 views

How to get name of file in source csh

I know perl has $0 to name the file. Is there a variable when you source a file in csh that is the name of the file being sourced?
Robj's user avatar
  • 11
0 votes
1 answer
161 views

Unable to remove file on Linux [closed]

I'm currently connected to a remote computer running on Linux and I have a random directory that arose after running one of my C programs. The directory name is of this form: 'H$'204'blahblah''u$'[]'$'...
PM25's user avatar
  • 33
0 votes
1 answer
3k views

csh/tcsh How to find if a particular string is in a variable/filename?

I want to check if a particular string is in a filename( which is a variable). [in csh/tcsh] #!/bin/tcsh set file = 'KZ.KKAR..BHZ.2008-01-18T19-16-51.SAC' set string = 'BHZ' echo $file if [[$file == *$...
VGB's user avatar
  • 457
0 votes
1 answer
905 views

How to set my tcsh prompt to show the execution time of the previous command?

I am using tcsh at work and would really appreciate knowing how long the execution of a command took place. For example: ~ ❯ sleep 55 ~ took 55s ❯
shaik azar AzarmadR's user avatar
0 votes
1 answer
437 views

Setting a variable with square bracket in cshell (UNIX)

set capportName = bl_l#ob0#cb set portName = `echo "${capportName}" | sed -e "s:#ob:\[:g" -e "s:#cb:\]:g" ` echo "$portName" OUTPUT: set: No match. I want the ...
Arjunesh Namboothiri's user avatar
0 votes
1 answer
198 views

How to convert a string in variable in shell

set lamdrills = ("drill_1-2" drill_2-3") set drill_1_2_fill_layers = ("cvf1") #input from other files set span = `echo "$lam_drl" | cut -f2 -d'_'` set startspan = `...
Sanjeev Raj's user avatar
0 votes
1 answer
63 views

Unclear apostrophe handling of csh

Can anybody explain, why #!/bin/csh tar --file=test.a --append --transform 's,^,data/,' data/jobid.dat works as expected, creating test.a with data/data/jobid.dat in it, but #!/bin/csh set opt="...
MRheinhardt's user avatar
0 votes
1 answer
720 views

tcsh passing a variable inside a shell script

I've defined a variable inside a shell script and I want to use it. For some reason, I cannot pass it into to command line that I need it in. Here's my script which fails at the last lines #! /usr//...
ZakS's user avatar
  • 1,121
0 votes
3 answers
142 views

Two string compare after grep [closed]

I got the following line 2020-10-17 14:55:39,586 INFO [http-bio-exec-60] [] [D88E13F571A51598613FAA078A215326.server.host.com.:9991] [some.package.Class] TEST_STRING - RSI: ...
ReDevil's user avatar
  • 77
0 votes
1 answer
779 views

Check if a variable is undefined or empty in single if-condition in csh

The variable existence and empty values can be checked in separate if-conditions in csh. if (! $?theVar) then or if ($theVar == "") then I would like to check these conditions in a single ...
srand9's user avatar
  • 347
0 votes
1 answer
90 views

Fetch last argument of csh source command

say I try following in csh: source script.csh a b c d source script.csh a s j source script.csh a k h s p I need to get the last argument passed with number of parameters varying per source'ing, ...
sreekesh padmanabhan's user avatar
0 votes
3 answers
648 views

grep - match string from the first n lines

I am trying to find the name of all files within a directory that matches a certain pattern. I have written the following bash command: find . -type f | xargs -r -n 25 egrep -l -m 1 'pattern' This ...
DrunkOnBytes's user avatar
0 votes
1 answer
301 views

csh scripting - passing variables and calling csh script from another csh script

I am trying to understand passing two variables from one csh script to another csh script. Perform simple arithmatic function then passing the sum variable to the orginal csh script. Then outputing ...
Zachary Daniels's user avatar
0 votes
1 answer
1k views

csh - Loop in all subdirectories and all files of a certain extension

I want to loop through all directories in a particular directory then loop through all files of *.cbl type. I get a "Badly placed ()'s" My test code: #!/bin/csh -f #--------------------------------...
user13696448's user avatar
0 votes
1 answer
252 views

Problems with C Shell bug: localpath: undefined variable

I am not experienced in Linux nor in shell command. The path that i stored the files are /home/cadence I have tried with other few other solutions with .csh error and after many trials, this was my ...
doyan's user avatar
  • 43
0 votes
1 answer
41k views

how to make an if-else in csh script

I'm trying to make an if-else in csh script but it is not working: do you know why this is not working? if($2 == "rx" && $3 == "2") then setenv project_name "mipi_2_rx_core_ns" ...
user204415's user avatar
0 votes
1 answer
537 views

Problems creating Tables from command line Mysql

When I type in the code into the Terminal it creates the Database but doesn't create the Table. When I type in use "locations" then "Show TABLES" it tells me that no Tables were ...
senpai's user avatar
  • 17
0 votes
2 answers
1k views

Can an environment variable be shared between 2 different shell types?

I came into an environment were when users log into our system, they log in with the csh by default. We also have an automation login (let's call it "autologin") that also invokes the csh by default. ...
RSteffy's user avatar

1
12 13
14
15 16
24