- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- difference between "sh -c" & "/usr/bin/sh"
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
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-20-2006 05:43 PM
тАО11-20-2006 05:43 PM
I've a process shows as below: ps -ef
sh -c exec /etc/cmcluster/mqm/mq.cntl
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2006 07:47 PM
тАО11-20-2006 07:47 PM
SolutionI believe sh -c will run the /usr/bin/sh.
Test:
$ cat a.sh
echo $PPID
sleep 10
echo $PPID
$ sh -c a.sh &
[1] 4142
$ 4142
ps -ef | grep 4142
godronpw 4143 4142 0 08:46:47 pts/ta 0:00 /usr/bin/sh a.sh
godronpw 4142 4045 0 08:46:47 pts/ta 0:00 sh -c a.sh
godronpw 4150 4045 0 08:46:53 pts/ta 0:00 grep 4142
$ 4142
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2006 10:45 PM
тАО11-20-2006 10:45 PM
Re: difference between "sh -c" & "/usr/bin/sh"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2006 01:04 AM
тАО11-21-2006 01:04 AM
Re: difference between "sh -c" & "/usr/bin/sh"
-c
Read commands from the command_string operand. Set the value of special parameter 0 (see Special Parameters) from the value of the command_name operand and the positional
parameters ($1, $2, and so on) in sequence from the remaining argument operands. No commands shall be read from the standard input.
I interpret that to say that "sh -c string" is the same as putting that string in a file and running it as a script:
# echo 'echo hello there' > test.script
# sh test.script
hello there
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2006 04:22 AM
тАО11-21-2006 04:22 AM
Re: difference between "sh -c" & "/usr/bin/sh"
Bill Hassell, sysadmin