HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- piping commands to a process in a script question ...
Operating System - HP-UX
1833154
Members
3049
Online
110051
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
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-24-2002 01:51 PM
10-24-2002 01:51 PM
piping commands to a process in a script question and problem
Hi all,
I am confused by several methods of piping commands w/in a script. I also have a problem getting a script to work.
I have seen the following:
yes | command params
block of code:
command params << !
^M
!
And this one (even I understand):
command | command | command
Any explanatory comments on the use of each method?
Also....I am trying to get a script to execute as an mpe command. Normally from the command line you would type:
#mpe
:command
:bye
#(back to ksh)
The command is actually two commands seperated by a semicolon. fence 7;queue=myjobque
I believe the shell is interpeting the semicolon. I need to pipe the command to the mpe shell as one string.
I have tried:
"string1;string2" | mpe
string1;string2 | mpe
mpe < string1;string2
Ideas?
tia
Doug
I am confused by several methods of piping commands w/in a script. I also have a problem getting a script to work.
I have seen the following:
yes | command params
block of code:
command params << !
^M
!
And this one (even I understand):
command | command | command
Any explanatory comments on the use of each method?
Also....I am trying to get a script to execute as an mpe command. Normally from the command line you would type:
#mpe
:command
:bye
#(back to ksh)
The command is actually two commands seperated by a semicolon. fence 7;queue=myjobque
I believe the shell is interpeting the semicolon. I need to pipe the command to the mpe shell as one string.
I have tried:
"string1;string2" | mpe
string1;string2 | mpe
mpe < string1;string2
Ideas?
tia
Doug
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2002 01:57 PM
10-24-2002 01:57 PM
Re: piping commands to a process in a script question and problem
Your first example is called a 'here document'. It means that anything up to an ending string is treated just as though you typed it in at the keyboard.
e.g.
cat << !EOF! > myfile
This is a test
This is some more stuff
!EOF!
cat myfile
would instruct cat to read from stdin and load lines until it sees '!EOF!'. At that point normal shell interpretation resumes and the next command is 'cat myfile'.
----------------------
I think what you are looking for is a 'compound command'.
( cmd1; cmd2; cmd3 ) | cmd4
This will take the stdouts of cmd1, cmd2, cmd3 (executed in that order) and feed them to stdin of cmd4.
e.g.
cat << !EOF! > myfile
This is a test
This is some more stuff
!EOF!
cat myfile
would instruct cat to read from stdin and load lines until it sees '!EOF!'. At that point normal shell interpretation resumes and the next command is 'cat myfile'.
----------------------
I think what you are looking for is a 'compound command'.
( cmd1; cmd2; cmd3 ) | cmd4
This will take the stdouts of cmd1, cmd2, cmd3 (executed in that order) and feed them to stdin of cmd4.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2002 11:03 PM
10-24-2002 11:03 PM
Re: piping commands to a process in a script question and problem
Try this
#!/bin/sh
mpe < :command
:bye
EOFMPE
This means that :command and :bye are commands given to mpe
EOFMPE is a arbitrary string, the second EOFMPE have to be placed completely in front of the line
Chris
#!/bin/sh
mpe <
:bye
EOFMPE
This means that :command and :bye are commands given to mpe
EOFMPE is a arbitrary string, the second EOFMPE have to be placed completely in front of the line
Chris
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