Am 06.09.2024 um 12:25 schrieb Hans: > Dear list, > > I am stuck with a little problem and know no one, whom I can ask. So I allow > me to ask here. > > I have several directories, and in each directory there is a shell script, > which MUST be started within and from its path. > > Now I want to edit a "master-shell-script", which I can start from anywhere > and which shall start each single shellscripts simultaniously, but within its > path. > > The structure looks like this: > > /directory-one/application_1/my-shell-1.sh > /directory-two/application_2/my-shell-2.sh > /directory-three/application_3/my-shell-3.sh > > Of course, I could mae my master-shell-script so, that I first go into the > first one, execute, then cd to the second one, execute and last cd to the > third one, execute, but I suppose, there is an easier way. > > Or does my idea not work at all? > > Thanks fo a short advice. > > Best > > Hans
I am thinking of gnu parallel. see this: > echo /dir1/program1 /local/dir2/subdir/program2 ~/scripts/test > /another/one/script4 | xargs -n1 echo | parallel --dr -n1 "cd {//};{/}" > cd /dir1;program1 > cd /local/dir2/subdir;program2 > cd /home/datakanja/scripts;test > cd /another/one;script4 # explanation: 4 arguments get splitted into lines by xargs, then parallel shows, what it would execute simultaneously (--dr = dry-run)