CSH Error Message


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting CSH Error Message
# 1  
Old 10-22-2003
CPU & Memory CSH Error Message

Hi,

I am new to unix, and trying to create a simple script called "nightjobs"

set TODAY=`date +"%m%d%y"`
echo -n "Please enter your Initials (3 alpha characters): "
read init
for GROUP in 4 5
do
set logfile="/home/OPER/LOGS/nightjobs"$GROUP"-TODAY".log"
set filnam="daily"$GROUP"-"$TODAY
echo "Night jobs started: " $TODAY >$logfile
< Here I have the commands to do the nightjobs >
done

When I try to run this script, I get the following error message:

# ./nightjobs
Please enter your Initials (3 alpha characters): KLN
for: Command not found.
do: Command not found.
GROUP: Undefined variable.

What am I doing wrong? Please help. My first line in the script is
#!/bin/csh -f

Thank you.
Latha Nair
# 2  
Old 10-22-2003
"for" and "do" are from sh, ksh, bash, or something like that. It looks like you wrote a sh script and carefully send it to csh to be run. Change the first line of your script to a shell that can run it. Or translate it into csh. csh has a foreach statement I think, but I'm not a csh expert.
# 3  
Old 10-22-2003
It works in ksh. I was trying to use csh because it can put the cursor right after the question
echo -n "Please enter your Initials (3 alpha characters): "
and let the user type in their initials. When I used ksh, it takes the cursor to the next line. I know this is not a big deal, but I just wanted to leave the cursor right after the endquote.

I will see if I can get any additional information on the 'foreach' statement.

Thank you for your help.
Latha Nair
# 4  
Old 10-22-2003
The echo statement can have varying syntax. The best thing to do in ksh is switch to print when you care.

print -n "Enter value - "
# 5  
Old 10-22-2003
wOw......... Things are sure easy when you know what you are doing. Thanks a bunch! That works for me, and that was all I was trying to accomplish.

This site is great!
Latha Nair Smilie
# 6  
Old 10-22-2003
Quote:
Originally posted by Latha Nair
Things are sure easy when you know what you are doing.
That is almost my personal motto. (I reverse words 2 and 3). I plan to have that carved into my tombstone. Smilie
# 7  
Old 10-22-2003
Unfortunately (or fortunately), we don't have tombstones! We get cremated! So, I guess whatever I have to say would be cremated with me! Smilie

My conclusion is that all the manuals, help routines , everything that is meant to make things easier...... makes sense only when you know the stuff (at least most of the time). I get better tips from people who have worked with the stuff (like I am doing now). I am slowly getting better, as each day goes by. We just have been up on Unix barely a month. I have only OpenVMS knowledge, which is NO GOOD at this point! I guess we have to roll with the punches (as they say?) I will keep a watch on this site for helpful information. I did go thru a lot of emails from folks like me - struggling with some day to day stuff.

Thanks again.....for your help. It is much appreciated.

Latha Nair Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

error LD: undefined variable while changing shell from bash to csh

Hi, i am a beginner in ubuntu. my default shell is bash. everytime i try to change the shell with command "csh", i get a message (probably an error message). after i get into c-shell, when i try to execute a c shellscript, then it showed the same message. any idea about what is this about or any... (1 Reply)
Discussion started by: Avinash Nayak
1 Replies

2. Emergency UNIX and Linux Support

Csh script with Undefined variable error

hi there I have this C shell script that was migrated from AIX to Linux, could someone please help me, I checked the syntax numerous times but I can't find out where the error is. The script is meant to find files older than 27 days and delete it #!/usr/bin/csh # ... (22 Replies)
Discussion started by: hedkandi
22 Replies

3. Shell Programming and Scripting

syntax error in .csh file

Hi all, I am trying to modify a script for research purposes and am having difficulty here as I have little prior experience with C-shell scripting. The script looks as follows (it includes tcl commands like runFEP that you can ignore) #!/bin/bash for ((old=1, new=2; old<=4; ... (5 Replies)
Discussion started by: chrisjorg
5 Replies

4. Shell Programming and Scripting

Missing ] error in csh script

The below script gives error: Missing ] #!/bin/csh set MAX=15 set PATTERN='dtsession' set NUM=`ps -eaf | grep -c $PATTERN` echo "No of dtsession = "$NUM if then echo 'Quota exceeded permissible limit' echo 'sending mail...............' mail hiten.r.chauhan@gmail.com<<EOF ... (2 Replies)
Discussion started by: hiten.r.chauhan
2 Replies

5. Shell Programming and Scripting

Undefined variable error in csh script

Below csh script gives error: Undefined variable:confused: #!/bin/csh $QUERY="netscape"; COUNT_NETSCAPE=${ps | grep -c $QUERY}; echo $COUNT_NETSCAPE; when run gives error adroit:/home/seo/hitendra 64 ] ./unix_6.sh QUERY: Undefined variable. What is the root cause of the... (3 Replies)
Discussion started by: hiten.r.chauhan
3 Replies

6. UNIX for Dummies Questions & Answers

What does this error message mean?

I was reviewing logs and I got this error message in /var/log/messages: Did not receive identification string from (IP ADDRESS) What does it mean? (6 Replies)
Discussion started by: mojoman
6 Replies

7. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

8. Linux

error message

Hello I got this message error on my box with linux red hat 2887a374 WsServer E WSVR0009E: Error occurred during startup Do you know what does that mean ! Thanks in advance (1 Reply)
Discussion started by: lo-lp-kl
1 Replies

9. Shell Programming and Scripting

getting Ambiguous error on kill -9 @pid from csh

Hello all i have simple script that executing program every 10 seconds im invoke this script as daemon with second script that put it in the background this is my first script (IsAliveTester.csh) #!/bin/csh -f @ iSleep = 10 set processName = "ClientTester" while(1) $processName ... (0 Replies)
Discussion started by: umen
0 Replies

10. AIX

Error Message with ls

When I try to list a directory that I have been using rsync to copy, I now am getting the following message. root # ls -alt /directory ls: /directory: Value too large to be stored in data type. total 0 I can change directory and list the contents of directories within /directory, but I... (2 Replies)
Discussion started by: sallender
2 Replies
Login or Register to Ask a Question