Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell driver drivers email error ethernet excel firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition problem router slow software sound trojan usb video virus vista wifi windows windows vista windows xp wireless
UNIX/Linux
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > UNIX/Linux >
Solved: .profile value read in ksh on AIX


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
surfnschultz's Avatar
Senior Member with 191 posts.
 
Join Date: Nov 2003
06-Jun-2005, 04:00 PM #1
Solved: .profile value read in ksh on AIX
I am setting the store number in the .profile like this STORNUM = 4 for example

I can echo $STORNUM from the command line and get the right answer.

In the ksh script I try to echo the value I get nothing...

How could I do this it all works except the stornum value.

if [ `echo $portnum | cut -b1` -eq $Stornum ]
echo $Stornum
else
echo "store number and port number do not match:EXITING...."
exit
fi
Squashman's Avatar
Distinguished Member with 12,689 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
06-Jun-2005, 10:19 PM #2
case sensitive!
surfnschultz's Avatar
Senior Member with 191 posts.
 
Join Date: Nov 2003
07-Jun-2005, 05:05 PM #3
If I do this on the comand ilne it works
echo $STORNUM it works I get a 4
If in my script I write echo $STORNUM I get nothing.

How do read a .profile variable in ksh? If I do an env it is not there because it is NOT a env variable it is set in the .profile as value for the person's store number.

Thanks.
Squashman's Avatar
Distinguished Member with 12,689 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
07-Jun-2005, 08:49 PM #4
You marked this solved. What fixed the problem. I think you need to use the export command in your .profile.

export stornum=4

Last edited by Squashman : 07-Jun-2005 09:29 PM.
codejockey's Avatar
Senior Member with 1,410 posts.
 
Join Date: Feb 2002
08-Jun-2005, 12:58 AM #5
Quote:
You marked this solved. What fixed the problem. I think you need to use the export command in your .profile.
I don't think this is the problem (although it could be just my misunderstanding of the problem). Normally, if you assign a value to a variable in a script (e.g., STORNUM=4) then that variable and that value are available ("in scope") for the duration of the script. If you want other scripts/programs to have access to the variable and its value, you can "export" the variable -- but if the variable has already been exported, this step is not necessary.

Surfnschultz has a case where the variable has been assigned a value but that value is not available within the script (although it is available on the command line). I suspect a typing error -- STORNUM is not the same as STORnUM or any other variant; as the Squashman mentioned, case matters (!).

If you provided the script as a whole, I suspect the problem would be clearer ...

Hope this helps.
__________________
The slowest component still sits at the keyboard.
surfnschultz's Avatar
Senior Member with 191 posts.
 
Join Date: Nov 2003
08-Jun-2005, 11:34 AM #6
EXPORT!!!!!!!!!!!!!! I knew I was missing something. Dang it been too long for this old dog

thanks guys.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:29 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.