Does this make sense? I need to "edit" the slot to turn it into a GPU board number but it puts more than one copy of the Perl result in the parallel command if I use more than one input list.
Is there a correct way to get just one instance of the perl substitution while keeping the ":::" syntax?
GNU parallel 20230822
Copyright (C) 2007-2023 Ole Tange, http://ole.tange.dk and Free Software
Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
GNU parallel comes with no warranty.
Web site: https://www.gnu.org/software/parallel
When using programs that use GNU Parallel to process data for publication
please cite as described in 'parallel --citation'.
bash-4.2$ parallel --dry-run --jobs 3 echo {= '$_=slot()-1' =} ::: 1 2 3 4
echo 0
echo 1
echo 2
echo 0
bash-4.2$ parallel --dry-run --jobs 3 echo {= '$_=slot()-1' =} ::: 1 2 3 4 ::: a b c
echo 0 0
echo 1 1
echo 2 2
echo 0 0
echo 1 1
echo 2 2
echo 0 0
echo 1 1
echo 2 2
echo 0 0
echo 1 1
echo 2 2
bash-4.2$ parallel --dry-run --jobs 3 echo {= '$_=slot()-1' =} ::: 1 2 3 4 ::: a b c ::: 1
echo 0 0 0
echo 1 1 1
echo 2 2 2
echo 1 1 1
echo 0 0 0
echo 2 2 2
echo 1 1 1
echo 0 0 0
echo 2 2 2
echo 1 1 1
echo 0 0 0
echo 2 2 2
I stumbled across a way to get the behavior I expected:
bash-4.2$ parallel --dry-run --jobs 3 echo {=1 '$_=slot()-1' =} ::: 1 2 3 4 ::: a b c
echo 1
echo 0
echo 2
echo 1
echo 0
echo 2
echo 1
echo 0
echo 2
echo 1
echo 0
echo 2
Not exactly sure why, but it works.