Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shell script giving an error

Status
Not open for further replies.

mmalefho

MIS
Jan 19, 2015
1
0
0
BW
i have the following shell script and it gives me errors

"mainbrain:/home/bscs6/scripts>sh LMS_PROFILE.sh
LMS_PROFILE.sh: ORACLE_SID=SEGODI: is not an identifier
mainbrain:/home/bscs6/scripts>^[ "## Heading ##


the script is as follows:


. /home/bscs6/.kshrc
set -x
monthy=`date +%m`
daty=`date +%d`
yeary=`date +%Y`
cd /home/bscs6/scripts
sqlplus sysadm/sysadm@SEGODI @lms_profile.sql
mv /home/bscs6/scripts/lmsprofile.log /home/bscs6/scripts/LMS_PROFILE_DUMP_$daty$monthy$yeary.txt
done
EOF'

 
By typing '[tt]sh[/tt]' in front of the shell script name, you are running it in the Bourne Shell, but your first command is sourcing a Korn Shell resource script. There may be Korn Shell commands in "[tt]/home/bscs6/.kshrc[/tt]" that don't work in the Bourne Shell.

I would add this as the first line of your script...

Code:
#!/bin/ksh

...so it forces it to use the Korn Shell. Then run it like this...

Code:
./LMS_PROFILE.sh

 
If that doesn't fix it, we'd need to see what's in '[tt]/home/bscs6/.kshrc[/tt]'.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top