Identifier In Shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Identifier In Shell script
# 1  
Old 01-23-2010
Identifier In Shell script

Hi,
I have a shell script and inside that shell script it calls a local .env file to set the environment for the shell script ,but the thing is that i got a error while running the script like
Code:
./myscript.sh it gives DB_NAME=dvcl021: is not an identifier

that DB_Name is accessed from my .env file
where DB_Name is my db name is my server and i has some many identifier so i need to redo it all ,so guys any idea abt how to set a identifier
# 2  
Old 01-23-2010
What does the .env file look like, and what does the script look like?
Can you post them both.
# 3  
Old 01-23-2010
Have you "source" the script with the variables? Something like?

Code:
. ./env_file

# 4  
Old 01-23-2010
Quote:
Originally Posted by Franklin52
Have you "source" the script with the variables? Something like?

Code:
. ./env_file

My .env file have like this
Code:
export DB_NAME=dvcl021
export USER_ID=my id
export PASSWORD=mypass
export DB_SERVER=myserve

and my script have these first few lines where it fetches the .env file
Code:
#!/usr/bin/sh
# myscript.sh
. $HOME/apps.env

and my apps.env is in the home folder only
# 5  
Old 01-23-2010
Perhaps your (Bourne) shell don't support the export syntax like that, export the variables as:

Code:
DB_NAME=dvcl021
export DB_NAME

PASSWORD=mypass
export PASSWORD
.
.

# 6  
Old 01-23-2010
Quote:
Originally Posted by Franklin52
Perhaps your (Bourne) shell don't support the export syntax like that, export the variables as:

Code:
DB_NAME=dvcl021
export DB_NAME

PASSWORD=mypass
export PASSWORD
.
.

It works and nice information
actually it's supported in HP-UX but not in Solaris
i don't why is this still the same bash i thought
# 7  
Old 01-23-2010
As mentioned, the syntax is not support by your Bourne shell.
Try to change the shebangs in your scripts, something like (check where ksh is installed):

Code:
#!/bin/ksh

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Variable not an identifier when script is run as another user

I am new to scripting I keep getting the error var2= is not an identifier when I run this script as another user. BUT when I run it as myself, the script completes without error. Any idea why? I assume it is because the new user has a different environment . How do I make the variables active... (5 Replies)
Discussion started by: newbie2010
5 Replies

2. Shell Programming and Scripting

Identifier in shell

Dear guys I need help here with syntax, I am trying to start script command to capture all user activities every day, I want the log file of each user to be named with his login ID + date time to overcome the possibility of over writing the log file if he logoff and login again. Here is was I wrote... (5 Replies)
Discussion started by: q8devilish
5 Replies

3. Shell Programming and Scripting

Contention Identifier Script

Hi Experts, Need some help with a script which is definetly beyond my scripting skills. Here is flat file that I have with 4 Key Columns KEYCOLUMN1 KEYCOLUMN2 KEYCOLUMN3 KEYCOLUMN4 123ABC AEG MANCHESTER BIGBOX... (2 Replies)
Discussion started by: PG3
2 Replies

4. Shell Programming and Scripting

is not an identifier

Hi Guys... I am using the following codes in my script: SID_L=`cat /var/opt/oracle/oratab|grep -v "^#"|cut -f1 -d: -s` SID_VAR=$SID_L for SID_RUN in $SID_VAR do ORACLE_HOME=`grep ^$SID_RUN /var/opt/oracle/oratab | \ awk -F: '{print $2}'` ;export ORACLE_HOME export... (2 Replies)
Discussion started by: Phuti
2 Replies

5. Shell Programming and Scripting

not an identifier

Hi I have already gone through this topic on this forum, but still i am getting same problem. I am using solaris 10. my login shell is /usr/bash i have got a script as below /home/gyan> cat 3.cm #!/usr/bin/ksh export PROG_NAME=rpaa001 if i run this script as below , it works fine... (3 Replies)
Discussion started by: gyanibaba
3 Replies

6. Shell Programming and Scripting

shell script to find and replace a line using a identifier

Hi all im having trouble starting with a shell script, i hope someone here can help me i have 2 files file1: 404905.jpg 516167 404906.jpg 516168 404917.psd 516183 404947.pdf 516250 file2: 516250 /tmp/RecyclePoster18241.pdf 516167 /tmp/ReunionCardFINAL.jpg 516168... (7 Replies)
Discussion started by: kenray
7 Replies

7. Solaris

-sh: is not an identifier

Hi , I am getting the following message when log into my unix account in sun solaris (version5.9)server. -sh: ORACLE_HOME=/apps/oracle/product/10.2.0/client_1: is not an identifier The ORACLE_HOME is set in .profile file. Another thing is that SID is also set inside .profile like... (4 Replies)
Discussion started by: megh
4 Replies

8. UNIX for Dummies Questions & Answers

Shell Script Unique Identifier Question

i All I have scripting question. I have a file "out.txt" which is generated by another script the file contains the following my_identifier8859574 logout The number is generated in the script and I have put the my_identifier bit in front of it as a unique identifier I now have... (7 Replies)
Discussion started by: grahambo2005
7 Replies

9. Shell Programming and Scripting

Getting is not an identifier error

Hi all, I am getting this error while setting CLASSPTH using a script my script is #!bin/ksh export CLASSPATH=$CLASSPATH:<some path>:<some path> If i do this thing on shell prompt individually it is working fine. but while using in shell script it is giving error. better if you... (12 Replies)
Discussion started by: swat
12 Replies

10. Shell Programming and Scripting

Problem with shell script...ORA-00904:invalid identifier

Guys, Please suggest me what's wrong with this script? #!/usr/bin/sh ############################################################################## # Author : Bhagat Singh # # # Date : Nov 13,2006 #... (12 Replies)
Discussion started by: bhagat.singh-j
12 Replies
Login or Register to Ask a Question