[Top][All Lists]

[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 <address@hidden> 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:



Please avoid it in the future.


        Shlomi Fish

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

Shlomi Fish

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

Please reply to list if it's a mailing list post - .

reply via email to

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