# How to use parallel execution in a shell script?

Filed under:
|
|
|
|
##### unix

I have a C shell script that does something like this:

#!/bin/csh
gcc example.c -o ex
gcc combine.c -o combine
ex file1 r1     <-- 1
ex file2 r2     <-- 2
ex file3 r3     <-- 3
#... many more like the above
combine r1 r2 r3 final
\rm r1 r2 r3


Is there some way I can make lines 1, 2 and 3 run in parallel instead of one after the another?

© Stack Overflow or respective owner

• #### How to restrict the users' shell allowing to execute shell programs

as seen on Server Fault - Search for 'Server Fault'
Is it possible to prevent any user to not use commands like ls, rm and other system commands which could harm the system. But the users should be able to execute shell programs. >>> More

• #### Shell extension installation not recognized by Windows 7 64-bit shell

as seen on Stack Overflow - Search for 'Stack Overflow'
I have a Copy Hook Handler shell extension that I'm trying to install on Windows 7 64-bit. The shell extension DLL is compiled in two separate versions for 32-bit and 64-bit Windows. The DLL implements DLLRegisterServer which adds the necessary registry entries. After adding the registry entries… >>> More

• #### Running shell commands without a shell window

as seen on Stack Overflow - Search for 'Stack Overflow'
With either subprocess.call or subprocess.Popen, executing a shell command makes a shell window quicky appear and disappear. How can I run the shell command without the shell window? >>> More

• #### Why can't I reinstall MySQL?

I've been looking all around the Internet for an answer but didn't find anything. I hope you can help me now. I have a server with MySQL. From one day to another, MySQL didn't let me enter with my root password anymore (accsess denied for user 'root'@'localhost' using password: 'YES'). So I tried… >>> More

• #### Bash/shell script - shell output redirection inside a function

as seen on Stack Overflow - Search for 'Stack Overflow'

• #### Shell scripting: Way to parse parameters from command line

as seen on Super User - Search for 'Super User'
myscript [-a a-arg] [-c c-arg] [-b] [-e] somedirectory Given that I want my shell script be invoked at the command line using the above parameters - where [these brackets] denote that they are optional - what is the best method to parse them? >>> More

• #### Best book for learning linux shell scripting?

as seen on Server Fault - Search for 'Server Fault'
I normally works on Windows machines but on some occasions I do switch to development on linux. And my most recent project will be written entirely on a certain linix platforms (not the standard Apache/MySQL/PHP setup). So I thought it would pay to learn to write some linux automation script now. I… >>> More

• #### windows shell scripting through java

as seen on Stack Overflow - Search for 'Stack Overflow'
i am designing a desktop application like nero for removable media storage that also includes features of copyfast. i want to add an option of my own choice in the windows explorer right click menu. how can i do that? am i proceeding in the right direction? >>> More