parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash for loop parallelising


From: Shlomi Fish
Subject: Re: Bash for loop parallelising
Date: Fri, 21 Oct 2016 11:18:50 +0300

Hi Samdani,

On Thu, 20 Oct 2016 14:40:35 +0530
Samdani A <samdani1593@gmail.com> wrote:

> Hi
> 
> Am trying to convert a simple bash script file which is given below. I was
> able to do it using parallel but not able to use multiple functions in the
> same line. Is there any other possible way to do the full job inside the
> for loop using parallel?
> 
> #!/bin/bash
> mkdir csv
> for f in *.txt
> do
>   command -n -c $f >${f%.txt}.csv
>   mv ${f%.txt}.csv csv/
>   rm $f

This code is potentially insecure due to the lack of "..." around the $f. See:

* http://shlomif-tech.livejournal.com/14671.html

* http://perl-begin.org/topics/security/code-markup-injection/

Please avoid it in the future.

Regards,

        Shlomi Fish


> done
> 
> 
> using parallel:
> 
> parallel command -n -c {} '>' {.}.csv ::: *.txt



-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://www.shlomifish.org/humour/bits/New-versions-of-the-GPL/

Yesterday I asked one of my students if she knew what an encyclopedia is, and
she said: β€œIs it something like Wikipedia?”.
        β€” http://twitter.com/alisonclement/status/8421314259

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]