Skip to main content

All Questions

Tagged with
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 ...
vikas's user avatar
  • 19
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 ...
Marietto's user avatar
  • 549
0 votes
1 answer
3k 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 "[email protected]" | /usr/sbin/sendmail -t Perl script print "To: ".$ARGV[0]."\n&...
Suman Valsange's user avatar
0 votes
0 answers
46 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 ...
Suman Valsange's user avatar
-2 votes
1 answer
118 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 ...
Suman Valsange's user avatar
4 votes
2 answers
2k 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 ...
Betaglutamate's user avatar
0 votes
1 answer
385 views

csh: Changing path in non-interactive login

I want this: $ ssh nopathcsh@lo 'echo $path' /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games To return this: /usr/bin /bin I have tried changing and ...
Ole Tange's user avatar
  • 35.8k
2 votes
2 answers
10k views

Undefined variable

I am trying to use this script: #!/bin/csh foreach SUB (1 2 3 4 5 6 7 8 9 10 11 12 13 14) echo $SUB foreach VISIT (1 2 3 4 5 6 7 8) echo $VISIT grep 'StudyDate' -f /home/...
Manal Os's user avatar
1 vote
2 answers
817 views

Replace filename with containing folder name (csh)

I have the exact same question as this poster but, I'm using csh. I can get the filename I want set x = V_181_V_d_2_um_phi_4.50_eV_tOn_0.5_ns/SteadyState_out.e cat "`echo $x | cut -d "/" -f1`.e" ...
user1543042's user avatar
0 votes
2 answers
6k views

vars: subscript out of range

I have a csh script (i know i know) and inside my script i run a sql query i then turn the output into a variable to use in my next command in the script. essentially it looks like this: set vars = `...
a.smith's user avatar
  • 725
0 votes
1 answer
1k views

How to loop through variables

I have a command in my csh script that can give at least 2 lines of output but may be more. I am turning these lines into separate variables that I then want to pass to another command. How do I set ...
a.smith's user avatar
  • 725
1 vote
1 answer
2k views

Adding corresponding elements from two arrays into new array using csh shell?

I want to use a csh script to merge corresponding elements of two arrays into another array. My script gives error as:- arrayfinal[1]: No match. the results is 0 0 0 0 0 my script is #!/bin/csh ...
asadz's user avatar
  • 233
1 vote
1 answer
2k views

Setting environment variable using shell script

I am using csh scripts for some automation purpose. I have a number of scripts, and the beginning of all of which I need to set a fixed set of environment variables. |----SCRIPT 1---| |----SCRIPT ...
johngreen's user avatar
  • 121
1 vote
2 answers
1k views

Merging two files using scripts

I am trying to merge two files of different lengths using a script. I want the longer file to be appended to the end of the shorter file and when both files are of equal length they are suppose to ...
NOOBCAKE's user avatar
1 vote
1 answer
59 views

Locating the terminal currently in use

I need to write a script to test if I'm 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 don't know how ...
Jon's user avatar
  • 13

15 30 50 per page