csh fails when setting variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting csh fails when setting variable
# 1  
Old 04-17-2007
csh fails when setting variable

I have a csh that is called from autosys. It fails when it hits this code

Code:
env | grep Rep
if ( $status == 0 ) then
  echo ""
else
  setenv REP ""
endif

However if I run it from the command line, as opposed to from autosys (job schduler) it runs fine. I thought it might be some kind of memory thing so I ran unlimit to no avail. I also added several large vars before the failure point and it still failed at the same place. Any ideas?
# 2  
Old 04-17-2007
I don't use autosys, but I assume it behaves like ccron and does not source the users environemnt when running jobs. Try sourcing the login files for the use at the start of the script, for exmple

Code:
source /home/<the_username>/.cshrc

# 3  
Old 04-17-2007
Actually autosys logs in as the user to submit the job. So it uses the same admin ID that I used at the command line. I also copied the csh script and the autosys jil file to new files that had a much smaller name. When I started those files, which were identical except for their names, from autosys it ran fine. I also copied the failing csh script to another file and then moved it back to the original name and got the same failure. I just tried copying the csh w/the smaller name back to the long name and it still fails.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Looping on variable having new line \n fails

I have a for loop that constructs a variable "filelistonly" having entries separated by "\n" new line. The second, third & fourth while loops are my attempt to iterate the variable "filelistonly" upon new line "\n", however non of them work. Below is my script: //First Loop for i in... (2 Replies)
Discussion started by: mohtashims
2 Replies

2. UNIX for Dummies Questions & Answers

Problem in C shell (csh) prompt setting containing the '$' char

Hi, I am trying to customize the command prompt of the C shell as follows: set prompt=" " The above one works fine but when I try to add a '$' (dollar) symbol into the string as set prompt=" " I am getting the error as: Illegal variable name However, this one set prompt = "-- %T %n %~ --... (2 Replies)
Discussion started by: royalibrahim
2 Replies

3. Shell Programming and Scripting

awk fails when using variable

This works when I try to execute normally : echo | format | nawk '/pci@1f,4000/{print x}; {x=$0 }' But fails when define a variable and put it in a file: cat test c=pci@1f,4000 echo | format | nawk "/$c/{print x}; {x=$0 }" ./test nawk: syntax error at source line 1 context is ... (6 Replies)
Discussion started by: aksijain
6 Replies

4. Shell Programming and Scripting

How to check existence of variable in csh

Hi All, I want to check existence of variable, whose name gets decided dynamically. E.g. value of this variable,is derived as $option_"exclude" , where value of option varies depending upon user input. I am trying to do it in a following way : set exclude_var = `echo $option"_exclude"`... (3 Replies)
Discussion started by: Rashmee
3 Replies

5. Shell Programming and Scripting

csh and variable values with spaces

my working shell is csh and even though if I try to run my script in plain sh, it behaves the same way. Here's a simple script: #!/bin/sh desc='"test my changes"' cmd="echo \"$desc\"" $cmd I want $desc to be passed as an argument to another command, but csh apparently doesn't like spaces in... (5 Replies)
Discussion started by: iskatel
5 Replies

6. Shell Programming and Scripting

Reading a variable in csh

I have a simple script that sets a value and reads the value in csh: set -x set a = 10 echo $a The output of the script does not show the value of a + set a = 10 + echo any help would be great. (4 Replies)
Discussion started by: pt14
4 Replies

7. Shell Programming and Scripting

help with multiline variable in csh

My shell is csh and it is required. I have a file like sample.txt ------------------------ a b c d e f g h i ------------------------ I want set the file to a variable and print it out in the same format. I have tried something like this, but not succed. % cat ~/tmp/sample.txt a b c d... (8 Replies)
Discussion started by: anykao
8 Replies

8. UNIX for Dummies Questions & Answers

move a variable value from csh to awk ...

Guys, following is my issue: ------------------------ #!/bin/csh # specify a counter @ k = 1 # loop while ($k < 3) # read all text file with a specific number less than 3 in the last column of a record foreach file ( *.txt) # capture the line by passing the column... (1 Reply)
Discussion started by: znbhatti
1 Replies

9. Shell Programming and Scripting

Variable value inconsistency on BASH and CSH

May God never give you the bane of working on Solaris. Now, I am trying to run this simple shell script: #!/bin/sh input="a b c" data="123" while read eachline do data="$data$eachline" done << EOF $(echo "$input") EOF... (2 Replies)
Discussion started by: pavanlimo
2 Replies

10. Red Hat

Help with csh env setting in Fedora 8

Hi there, How can I change bash to csh when starting a terminal, and set some aliases for csh? I can't find such files like .cshrc in my home directory. Thanks a lot (1 Reply)
Discussion started by: dustinwang2003
1 Replies
Login or Register to Ask a Question