- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Fork process in Shell scripting
Operating System - HP-UX
1819870
Members
2374
Online
109607
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
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
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-26-2004 02:50 PM
тАО12-26-2004 02:50 PM
Fork process in Shell scripting
Hi Guys,
I am just curious, I know that system call "fork" is created whenever a shell command is invoked on the terminal prompt. However, what actually happened when say I ran a script of korn shell, is a single fork created,or is one created for each command it passes thru?
Thank u for your help
regards
Henry
I am just curious, I know that system call "fork" is created whenever a shell command is invoked on the terminal prompt. However, what actually happened when say I ran a script of korn shell, is a single fork created,or is one created for each command it passes thru?
Thank u for your help
regards
Henry
- Tags:
- fork
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2004 03:06 PM
тАО12-26-2004 03:06 PM
Re: Fork process in Shell scripting
When you pass on a shell script to ksh, it executes
fork() system call to create a new shell and passes
on the script to it (along with bunch of env variables).
No more shell is creates (unless the script itself calls
another shell script).
- Biswajit
fork() system call to create a new shell and passes
on the script to it (along with bunch of env variables).
No more shell is creates (unless the script itself calls
another shell script).
- Biswajit
:-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-28-2004 01:20 AM
тАО12-28-2004 01:20 AM
Re: Fork process in Shell scripting
Hi!
Really fork is created a child-process.
So you can check the result of your <script> by putting in <script> something like
sleep 1000
then starting it and looking at
running processes using:
#ps -ef | grep <script>
You can see ksh-process like parent and the <script> process like child. That means,
that system call fork is executed.
Regards,Stan
- Tags:
- PS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-28-2004 01:28 AM
тАО12-28-2004 01:28 AM
Re: Fork process in Shell scripting
Henry,
In fact, in order to avoid spawing a child process, your shell script has to use the ". command" convention. For example, in order to set environment variables in a separate script but have them still valid for the current script, you would need to express it like this:
. myvarscript
Pete
Pete
In fact, in order to avoid spawing a child process, your shell script has to use the ". command" convention. For example, in order to set environment variables in a separate script but have them still valid for the current script, you would need to express it like this:
. myvarscript
Pete
Pete
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
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP