- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- variable expansion and prevention
Operating System - HP-UX
1753879
Members
7612
Online
108809
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
Discussions
Discussions
Forums
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
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-18-2009 11:13 AM
тАО02-18-2009 11:13 AM
I have spent a few hrs on this and I think I need to start asking questions. I haven't found any information on this.
I want to be able to use a variable name as a variable value in the same script. Like this:
mary=lamb
peter=pumpkin
for i in mary peter
do
echo "$i has the last name of ${$i}"
done
No, this doesn't work but the output should look like this:
mary has the last name of lamb
peter has the last name of pumpkin
I can easily do this in perl with a hash but I need to do it in a shell script (sh or ksh) if it's possible.
I've tried a miriad of ways and I'm hoping someone can assist me with it.
I want to be able to use a variable name as a variable value in the same script. Like this:
mary=lamb
peter=pumpkin
for i in mary peter
do
echo "$i has the last name of ${$i}"
done
No, this doesn't work but the output should look like this:
mary has the last name of lamb
peter has the last name of pumpkin
I can easily do this in perl with a hash but I need to do it in a shell script (sh or ksh) if it's possible.
I've tried a miriad of ways and I'm hoping someone can assist me with it.
Conformity Destroys a mans initiative and independence. It supresses his powerful inner drive to do his own thing.
Solved! Go to Solution.
- Tags:
- variable
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-18-2009 11:21 AM
- Tags:
- eval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-18-2009 11:45 AM
тАО02-18-2009 11:45 AM
Re: variable expansion and prevention
SWEET!!!!
I bet I tried every other possible combination.
Thanks a bunch!
I bet I tried every other possible combination.
Thanks a bunch!
Conformity Destroys a mans initiative and independence. It supresses his powerful inner drive to do his own thing.
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP