HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ssh and awk
Operating System - HP-UX
1833780
Members
2289
Online
110063
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
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
12-01-2006 12:01 AM
12-01-2006 12:01 AM
Hi all,
I'm running a little ssh script to obtain memory information using adb and also show crash directory sizing. Its pretty simple but I just don't get the way I have had to script it to get it to work specifically this line.
ssh ${i} "bdf /var/adm/crash | grep -iv File | awk '{print \"total space \"\$2\" Freespace \"\$4}'"
Why do I need the ignore special characters slash???? I don't when I run it locally on my linux server or remotely on the hp box. I just don't get it.
I'm running a little ssh script to obtain memory information using adb and also show crash directory sizing. Its pretty simple but I just don't get the way I have had to script it to get it to work specifically this line.
ssh ${i} "bdf /var/adm/crash | grep -iv File | awk '{print \"total space \"\$2\" Freespace \"\$4}'"
Why do I need the ignore special characters slash???? I don't when I run it locally on my linux server or remotely on the hp box. I just don't get it.
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2006 12:22 AM
12-01-2006 12:22 AM
Solution
Hi Adam:
By outer double quotes cause the contents between to be treated as one argument. The inner, escaped double quotes are required to preserve the quote character at that point. Consider the difference between:
# echo "this is \"it\" ok?"
this is "it" ok?
# echo "this is "it" ok?"
this is it ok?
Regards!
...JRF...
By outer double quotes cause the contents between to be treated as one argument. The inner, escaped double quotes are required to preserve the quote character at that point. Consider the difference between:
# echo "this is \"it\" ok?"
this is "it" ok?
# echo "this is "it" ok?"
this is it ok?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2006 03:17 AM
12-01-2006 03:17 AM
Re: ssh and awk
When you run remote commands like that it's also important to be conscious of how many different shells are involved. The command above actually gets interpreted by a shell twice, first on the local machine and again on the remote machine.
Using single quotes wherever possible helps keep things simple. If you put your awk expression in double quotes instead you would need to use \\\" and \\\$ because the remote shell would have to see \" and \$ to pass " and $ through to awk. And just think how messy it would get if you then tried to print a quote in the awk output.
Using single quotes wherever possible helps keep things simple. If you put your awk expression in double quotes instead you would need to use \\\" and \\\$ because the remote shell would have to see \" and \$ to pass " and $ through to awk. And just think how messy it would get if you then tried to print a quote in the awk output.
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 2025 Hewlett Packard Enterprise Development LP