- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Use content of variables to get content of var...
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
тАО12-13-2005 09:49 AM
тАО12-13-2005 09:49 AM
type
dest
Then I have a bunch of variable pre-define such as:
cku=1234567890@txt.domain
The content of "type" will be "c".
The content of "dest" will be "ku"
So I want to display teh content of varible "cku" by concatenating the contents of "type" and "dest".
I've tried
echo "${${type}${dest}}" and other forms to try and get the content of "cku" displayed.
I will use this in a more complicated script which is why I'm not simply doing
echo "${cku}"
Can I use the content of 2 variables to build the name of the third variable and then display the content of that 3rd variable?
Cheers
Solved! Go to Solution.
- Tags:
- variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2005 09:56 AM
- Tags:
- eval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2005 10:01 AM
тАО12-13-2005 10:01 AM
Re: Use content of variables to get content of variable
I don't believe that the shell provides this kind of substitution. One sure wishes that it did.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2005 10:06 AM
тАО12-13-2005 10:06 AM
Re: Use content of variables to get content of variable
Why thanks :-))
/* No points for either of my posts, please! */
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2005 10:13 AM
тАО12-13-2005 10:13 AM
Re: Use content of variables to get content of variable
The eval works on it's own.
But how can I plug that into a command?
Example
mailx -s " some text " eval echo \$$x
Where it would result in
mailx -s "some text" 1234567890@txt.domain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2005 10:18 AM
тАО12-13-2005 10:18 AM
Re: Use content of variables to get content of variable
Will post solution and assign points ASAP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2005 10:22 AM
тАО12-14-2005 10:22 AM
Re: Use content of variables to get content of variable
--- start of script
cku="1234567890@txt.cellprovider.com"
eku="ku@emailaddress.com"
escalate() {
# format
# escalate type destination_name message
nf_dest="${1}${2}"
nf_body="$3"
#Purposely not using subject line in mailx
echo "${3}" | eval mailx \$${nf_dest}
}
# Sample calls to function
escalate c ku "test message to cell"
escalate e ku "test message to email"
--- end of script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2008 04:16 AM
тАО04-17-2008 04:16 AM