- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: ssh , su , sh re-visited with "for" loop
Operating System - HP-UX
1752808
Members
5870
Online
108789
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
тАО10-30-2010 06:48 PM
тАО10-30-2010 06:48 PM
Re: ssh , su , sh re-visited with "for" loop
Hi
thks Dennis!!!
This problem is a pain but the best solution in this case is running it from 1 single local machine. Can we assume, for the sake of focus and clarity that there is good reason why each step is required. Ie...the use of sh -c, su etc.
Essentially, solutions should be robust and portable. In THIS case that is achieved with my question.
Dennis was correct in his observation. I am ensuring that commands run in the same shell, using common commands producing the same results and error types.
Again, this detracts from the actual question. Its isnt which is the best method for achieving the result....its how do I get the provided bit of "code" to work.
I think we are almost there though.....
Dennis ....I tried :
ssh -f hpuxbox su - adiffuser -c 'sh -c "for i in 1\;do echo this is \$i\; done "'
but got
# The copyright note can be read by typing: cat /etc/copyright
Not a terminal
stty: : Not a typewriter
for: Command not found.
...and as a reminder ...each element works fine when you log on remotely and perform the commands etc.
ps. I do appreciate suggestions on "other ways"...but in this case i really need the solution to this particular question ...thks in advance.
Points will be assigned regardless so feel free to join in ...
thks Dennis!!!
This problem is a pain but the best solution in this case is running it from 1 single local machine. Can we assume, for the sake of focus and clarity that there is good reason why each step is required. Ie...the use of sh -c, su etc.
Essentially, solutions should be robust and portable. In THIS case that is achieved with my question.
Dennis was correct in his observation. I am ensuring that commands run in the same shell, using common commands producing the same results and error types.
Again, this detracts from the actual question. Its isnt which is the best method for achieving the result....its how do I get the provided bit of "code" to work.
I think we are almost there though.....
Dennis ....I tried :
ssh -f hpuxbox su - adiffuser -c 'sh -c "for i in 1\;do echo this is \$i\; done "'
but got
# The copyright note can be read by typing: cat /etc/copyright
Not a terminal
stty: : Not a typewriter
for: Command not found.
...and as a reminder ...each element works fine when you log on remotely and perform the commands etc.
ps. I do appreciate suggestions on "other ways"...but in this case i really need the solution to this particular question ...thks in advance.
Points will be assigned regardless so feel free to join in ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2010 07:46 PM
тАО10-30-2010 07:46 PM
Re: ssh , su , sh re-visited with "for" loop
ssh -f otherhost 'su - otheruser -c "sh -c \"for i in 1 2 3 ; do echo this is \\\$i ; done\" " '
Works for me.
Works for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2010 08:04 PM
тАО10-30-2010 08:04 PM
Re: ssh , su , sh re-visited with "for" loop
thanks - that worked !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2010 08:04 PM
тАО10-30-2010 08:04 PM
Re: ssh , su , sh re-visited with "for" loop
Thks for all the help
- « Previous
-
- 1
- 2
- Next »
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