Monday, March 7, 2016

Working with SubShell in Linux:

When you want to make some task got forked and get the child process run as a subshell, then you can go for the below shell script which does the same for you, increase sleep time to check the execution status of the child process with the command "ps -ef | grep sub" in one more terminal:

#!/bin/bash
while :
do
echo "[ hit CTRL+C to stop]"
echo Enter Command to Process:;
read cmd;
echo $cmd > tmp2;
(sleep 3;bash -s <tmp2 );
done


No comments:

Post a Comment