GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script variables
Operating System - HP-UX
1847194
Members
4466
Online
110263
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2004 07:54 AM
02-25-2004 07:54 AM
I have a script that calls another script, which runs a cmd. I then take the exit variable and store it...
gzip -cxvf offline_backup.tar.bz2 -p --same-permissions -m --same-owner --overwrite
TAREXIT=${?}
I have done testing when the gtar exit's succesfully and not successfully.
How do I use TAREXIT in my original script?
I tried to do..
gzip -cxvf offline_backup.tar.bz2 -p --same-permissions -m --same-owner --overwrite
TAREXIT=${?}
export $TAREXIT
But I get an error...
/home/scripts/backup/uncompress_db.scr[45]: 2: is not an identifier
./test[175]: TAREXIT: Parameter not set.
I am doing these scripts in ksh
gzip -cxvf offline_backup.tar.bz2 -p --same-permissions -m --same-owner --overwrite
TAREXIT=${?}
I have done testing when the gtar exit's succesfully and not successfully.
How do I use TAREXIT in my original script?
I tried to do..
gzip -cxvf offline_backup.tar.bz2 -p --same-permissions -m --same-owner --overwrite
TAREXIT=${?}
export $TAREXIT
But I get an error...
/home/scripts/backup/uncompress_db.scr[45]: 2: is not an identifier
./test[175]: TAREXIT: Parameter not set.
I am doing these scripts in ksh
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2004 08:02 AM
02-25-2004 08:02 AM
Solution
You can have the calling program take the output from the called program and assign it to a variable, which would require the called program to ECHO the TAREXIT variable.
OR
write the TAREXIT variable to a file in the format of:
export TAREXIT
then have the calling program SOURCE (. ./thefilenameusedabove) thefilenamed usedabove.
OR
if it's not necessary to have the called script external, then put it into the calling program.
live free or die
harry
OR
write the TAREXIT variable to a file in the format of:
export TAREXIT
then have the calling program SOURCE (. ./thefilenameusedabove) thefilenamed usedabove.
OR
if it's not necessary to have the called script external, then put it into the calling program.
live free or die
harry
Live Free or Die
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2004 08:03 AM
02-25-2004 08:03 AM
Re: script variables
you use:
TAREXIT=${?}
exit $TAREXIT
in the call script
cmd
retcode=${?}
#retcode will now equal the value of TAREXIT
TAREXIT=${?}
exit $TAREXIT
in the call script
cmd
retcode=${?}
#retcode will now equal the value of TAREXIT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2004 08:04 AM
02-25-2004 08:04 AM
Re: script variables
You simply
export TAREXIT
But you should know that export works only in one direction: From Parent to Child process. Make sure that you are not trying to use a variable exported by a child process in a parent.
export TAREXIT
But you should know that export works only in one direction: From Parent to Child process. Make sure that you are not trying to use a variable exported by a child process in a parent.
If it ain't broke, I can fix that.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP