Re: how to build the parallel nature into the script?

2017-12-13 Thread Joe Sapp
On Wed, Dec 13, 2017 at 1:06 AM, paralleluser  wrote:
> Dear Friends,
>
> Given a shell script, script.bash, it takes one argument, $1, which is a file 
> name to process, like this:
> script.bash myfile.txt
>
> To parallelize this I can do:
> parallel script.bash ::: *.txt
>
> But what is the easiest way to build the parallel nature into the script so I 
> can do:
> script.bash *.txt
>
> and parallel does its magic behind the scenes?
>
> Thanks!...
>

Try replacing the shebang with (see
https://www.gnu.org/software/parallel/parallel_tutorial.html#Parallelizing-existing-scripts):

#!/usr/bin/parallel --shebang-wrap /bin/bash

-- 
Joe



Re: how to build the parallel nature into the script?

2017-12-13 Thread Shlomi Fish
Hi,

On Wed, 13 Dec 2017 01:06:28 -0500
paralleluser  wrote:

> Dear Friends,
> 
> Given a shell script, script.bash, it takes one argument, $1, which is a file
> name to process, like this: script.bash myfile.txt
> 
> To parallelize this I can do:
> parallel script.bash ::: *.txt
> 
> But what is the easiest way to build the parallel nature into the script so I
> can do: script.bash *.txt
> 

Why not write a wrapper script that does:


#!/bin/bash
parallel script.bash ::: "$@"


Regards,

Shlomi

> and parallel does its magic behind the scenes?
> 
> Thanks!...
> 



-- 
-
Shlomi Fish   http://www.shlomifish.org/
Best Introductory Programming Language - http://shlom.in/intro-lang

If a million Shakespeares had to write together, they would write like a monkey.
— based on Stephen Wright, via Nadav Har’El.

Please reply to list if it's a mailing list post - http://shlom.in/reply .