error is not an identifier in shell script

i am using $PVT_Config in my script..
when i do echo shows me value of variable but after that i am using in script won't work..even not allow me to export that value..

i try to export variable in script...but want allow me
+ echo /qual/ssm/stat/current/config
+ echo QAS
+ echo /qual/ssm/stat/current
+ export /qual/ssm/stat/current/config
/usr/bin/ksh[242]: /qual/ssm/stat/current/config: is not an identifier
parlepointAsked:
Who is Participating?
 
omarfaridConnect With a Mentor Commented:
Hi,

+ export /qual/ssm/stat/current/config
/usr/bin/ksh[242]: /qual/ssm/stat/current/config: is not an identifier

The above lines are taken from the initial post of the question, and it sounds that the problem is as Tintin recommended.

This is because:

if you have a script a.sh like this:

PVT_Config=/qual/ssm/stat/current
echo $PVT_Config
export $PVT_Config

and you

sh -x a.sh
+ PVT_Config=/qual/ssm/stat/current
+ echo /qual/ssm/stat/current
/qual/ssm/stat/current
+ export /qual/ssm/stat/current
a.sh: export: `/qual/ssm/stat/current': not a valid identifier


0
 
ozoCommented:
how are you using $PVT_Config in your script?
0
 
ozoCommented:
did you say
export PVT_Config
or
export $PVT_Config
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
parlepointAuthor Commented:
i m using export PVT_config
after that i did
echo $PVT_config
print "$PVT_config"
it's printing...
=====
just after that i am given cd $PVT_config/a/b/c
that's not finding...
0
 
ozoCommented:
can you post an example of a script that exhibits those symptoms
0
 
parlepointAuthor Commented:
echo $PVT_LOC_CONFIG
export PVT_LOC_CONFIG
print "=========$PVT_LOC_CONFIG======"

cd $PVT_LOC_CONFIG/javaserver/com/fedex/common/security_framework

 # INDIVIDUALLY ENCRYPT EACH PASSWORD PROJECT
 IFS="$CM_IFSDEFAULT"
   for PVT_PROPFILE in *.props
   do
    # * Obtain project name from properties file name
    PVT_PROJECT="${PVT_PROPFILE%.*}"
done
0
 
ozoCommented:
Where did you set PVT_LOC_CONFIG?  dies it have any relationship to $PVT_Config ?
0
 
parlepointAuthor Commented:
PVT_config is example of PVT_LOC_CONFIG..

that i am reading from txt.file.
0
 
ozoCommented:
can post a script that shows an example of what you mean?
0
 
TintinCommented:
I'd be 99% certain the only case where you'd get the message "is not an identifier" is where you do

export $variable_name

eg:

$ echo $0
ksh
$ foo=abc:def
$ export $foo
ksh: abc:def: is not an identifier

0
 
ozoCommented:
That's why I asked how PVT_Config was being used
was it
export PVT_Config
or
export $PVT_Config
0
 
parlepointAuthor Commented:
sorry guys late reply..

=======================================
PVT_LOC_CONFIG="$( grep '^ProjectLocation=' temp.txt )" ; PVT_LOC_CONFIG="${PVT_LOC_CONFIG##*=}"
* reading pvt_loc_config from temp.txt file and excute...
echo $PVT_LOC_CONFIG
export PVT_LOC_CONFIG
print "=========$PVT_LOC_CONFIG======"

cd $PVT_LOC_CONFIG/javaserver/com/fedex/common/security_framework

 # INDIVIDUALLY ENCRYPT EACH PASSWORD PROJECT
 IFS="$CM_IFSDEFAULT"
   for PVT_PROPFILE in *.props
   do
    # * Obtain project name from properties file name
    PVT_PROJECT="${PVT_PROPFILE%.*}"
done


=======================

output:
PVT_LOC_CONFIG=/qual/ssm/stat/config
cd /javaserver/com/fedex/common/security_framework
(HERE IS PROBLEM...IS NOT TAKING VALUE OF $PVT_LOC_CONFIG)

hopefully now you guys understand where is problem..

Thanks
PP
0
 
ahoffmannCommented:
cd "$PVT_LOC_CONFIG"/javaserver/com/fedex/common/security_framework
0
 
parlepointAuthor Commented:
same error is coming...
0
 
ozoConnect With a Mentor Commented:
echo $PVT_LOC_CONFIG
export PVT_LOC_CONFIG
print "=========$PVT_LOC_CONFIG======"

cd $PVT_LOC_CONFIG/javaserver/com/fedex/common/security_framework


output:
PVT_LOC_CONFIG=/qual/ssm/stat/config
cd /javaserver/com/fedex/common/security_framework

Something else is wrong
where is the output of
echo $PVT_LOC_CONFIG
print "=========$PVT_LOC_CONFIG======"

and how did
cd /javaserver/com/fedex/common/security_framework
get output?

cd $PVT_LOC_CONFIG/javaserver/com/fedex/common/security_framework
does not echo

are you sure the
PVT_LOC_CONFIG="$( grep '^ProjectLocation=' temp.txt )" ;
is finding ^ProjectLocation=?
0
 
parlepointAuthor Commented:
i found the problem..
it in txt file...having space after last destination.

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.