- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Shell scripting - Storing command output in a ...
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
тАО11-30-2008 12:13 AM
тАО11-30-2008 12:13 AM
Example:
Command output:
$ lspv | grep active | grep 15
hdiskpower15 0000792a05830e15 Ora0600 active
hdiskpower115 0000792a9c882ece Ora0600 active
$ opt_cmd=`lspv | grep active | grep 15`
$ echo $opt_cmd
hdiskpower15 0000792a05830e15 Ora0600 active hdiskpower115 0000792a9c882ece Ora0600 active
Can someone tell me is there any way i can store the output to a varibale exactly same as the command output.
Solved! Go to Solution.
- Tags:
- command substitution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2008 12:27 AM
тАО11-30-2008 12:27 AM
Re: Shell scripting - Storing command output in a variable
Otherwise you'll need to save the output in a file:
lspv | grep active | grep 15 > output
opt_cmd=$(< output)
- Tags:
- quoting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2008 12:31 AM
тАО11-30-2008 12:31 AM
Re: Shell scripting - Storing command output in a variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2008 12:45 AM
тАО11-30-2008 12:45 AM
Solutionhttp://forums.itrc.hp.com/service/forums/helptips.do?#33
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2008 05:28 AM
тАО11-30-2008 05:28 AM
Re: Shell scripting - Storing command output in a variable
You have to love these postings from AIX environments (not that it matters for this question) :-) I guess is shows how valuable a place the ITRC can be.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2008 10:22 AM
тАО11-30-2008 10:22 AM
Re: Shell scripting - Storing command output in a variable
> the ITRC can be.
Or how thoroughly lost and confused its users
can be.