parallel
[Top][All Lists]
Advanced

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

Help running an example (Calling Bash functions) from the manual


From: Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC]
Subject: Help running an example (Calling Bash functions) from the manual
Date: Thu, 22 May 2014 14:41:28 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Parallel List,

I'm a newbie to GNU parallel, but I decided today to try and parallelize a Bash script I have but I just kept getting stymied. So, I thought I'd just try the example from the manual:

http://www.gnu.org/software/parallel/man.html#example__calling_bash_functions

However, I can't seem to run that! To wit I placed that example in a file called "tpar.bash" and just tried to run it, but it doesn't work:

(231) $ parallel --version
GNU parallel 20140522
Copyright (C) 2007,2008,2009,2010,2011,2012,2013,2014 Ole Tange and Free 
Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://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: http://www.gnu.org/software/parallel

When using programs that use GNU Parallel to process data for publication 
please cite:

O. Tange (2011): GNU Parallel - The Command-Line Power Tool,
;login: The USENIX Magazine, February 2011:42-47.

(232) $ bash --version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

(233) $ cat tpar.bash
#!/bin/bash

doit() {
  echo Doing it for $1
  sleep 2
  echo Done with $1
}
export -f doit
parallel doit ::: 1 2 3
doubleit() {
  echo Doing it for $1 $2
  sleep 2
  echo Done with $1 $2
}
export -f doubleit
parallel doubleit ::: 1 2 3 ::: a b

(234) $ bash tpar.bash
doit: Command not found.
doit: Command not found.
doit: Command not found.
doubleit: Command not found.
doubleit: Command not found.
doubleit: Command not found.
doubleit: Command not found.
doubleit: Command not found.
doubleit: Command not found.

Now, from the look of the bash output, parallel seems to be doing its job, right? So I'm guessing that makes this a Bash issue and not a parallel issue?

I thought I'd ask here first since it was in the parallel manual. But I'll gladly ask this instead on the Bash list if you think that would be better.

Matt

--
Matt Thompson          SSAI, Sr Software Test Engr
NASA GSFC, Global Modeling and Assimilation Office
Code 610.1, 8800 Greenbelt Rd, Greenbelt, MD 20771
Phone: 301-614-6712              Fax: 301-614-6246



reply via email to

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