2012-11-22 11:10:45 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-01-24 01:02:07 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-2024 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
|
2021-03-22 20:16:35 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2012-11-22 22:19:00 +00:00
|
|
|
|
2023-01-29 23:40:56 +00:00
|
|
|
tmp="$(mktemp -d)"
|
|
|
|
# Test with tmpdir with spaces
|
|
|
|
TMPDIR="$tmp/ "
|
|
|
|
export TMPDIR
|
|
|
|
mkdir -p "$TMPDIR"
|
|
|
|
|
2016-08-13 17:11:15 +00:00
|
|
|
par_basic_shebang_wrap() {
|
|
|
|
echo "### Test basic --shebang-wrap"
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/basic--shebang-wrap
|
2023-02-03 15:37:25 +00:00
|
|
|
qscript=$(parallel -0 --shellquote ::: "$script")
|
2023-01-29 23:40:56 +00:00
|
|
|
cat <<EOF > "$script"
|
2013-08-21 15:04:33 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/perl
|
2012-11-22 11:10:45 +00:00
|
|
|
|
|
|
|
print "Shebang from perl with args @ARGV\n";
|
|
|
|
EOF
|
|
|
|
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
args() { echo arg1; echo arg2; echo "arg3.1 arg3.2"; }
|
|
|
|
"$script" "$(args)"
|
2016-08-13 17:11:15 +00:00
|
|
|
echo "### Test basic --shebang-wrap Same as"
|
2023-02-03 15:37:25 +00:00
|
|
|
parallel -k /usr/bin/perl "$qscript" ::: "$(args)"
|
2016-08-13 17:11:15 +00:00
|
|
|
echo "### Test basic --shebang-wrap stdin"
|
2023-01-29 23:40:56 +00:00
|
|
|
args | "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
echo "### Test basic --shebang-wrap Same as"
|
2023-02-03 15:37:25 +00:00
|
|
|
args | parallel -k /usr/bin/perl "$qscript"
|
2023-01-29 23:40:56 +00:00
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
2012-11-22 22:19:00 +00:00
|
|
|
|
2016-08-13 17:11:15 +00:00
|
|
|
par_shebang_with_parser_options() {
|
|
|
|
seq 1 2 >/tmp/in12
|
|
|
|
seq 4 5 >/tmp/in45
|
|
|
|
|
|
|
|
echo "### Test --shebang-wrap with parser options"
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/with-parser--shebang-wrap
|
2023-02-03 15:37:25 +00:00
|
|
|
qscript=$(parallel -0 --shellquote ::: "$script")
|
2023-01-29 23:40:56 +00:00
|
|
|
cat <<EOF > "$script"
|
2012-12-02 20:11:27 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/perl -p
|
2012-11-22 11:10:45 +00:00
|
|
|
|
|
|
|
print "Shebang from perl with args @ARGV\n";
|
|
|
|
EOF
|
|
|
|
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" /tmp/in12 /tmp/in45
|
2016-08-13 17:11:15 +00:00
|
|
|
echo "### Test --shebang-wrap with parser options Same as"
|
2023-02-03 15:37:25 +00:00
|
|
|
parallel -k /usr/bin/perl -p "$qscript" ::: /tmp/in12 /tmp/in45
|
2016-08-13 17:11:15 +00:00
|
|
|
echo "### Test --shebang-wrap with parser options stdin"
|
2023-01-29 23:40:56 +00:00
|
|
|
(echo /tmp/in12; echo /tmp/in45) | "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
echo "### Test --shebang-wrap with parser options Same as"
|
2023-02-03 15:37:25 +00:00
|
|
|
(echo /tmp/in12; echo /tmp/in45) | parallel -k /usr/bin/perl "$qscript"
|
2023-01-29 23:40:56 +00:00
|
|
|
rm "$script"
|
2012-11-22 22:19:00 +00:00
|
|
|
|
2016-08-13 17:11:15 +00:00
|
|
|
echo "### Test --shebang-wrap --pipe with parser options"
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/pipe--shebang-wrap
|
2023-02-03 15:37:25 +00:00
|
|
|
qscript=$(parallel -0 --shellquote ::: "$script")
|
2023-01-29 23:40:56 +00:00
|
|
|
cat <<EOF > "$script"
|
2012-12-28 20:30:30 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k --pipe /usr/bin/perl -p
|
2012-11-22 11:10:45 +00:00
|
|
|
|
2012-11-22 22:19:00 +00:00
|
|
|
print "Shebang from perl with args @ARGV\n";
|
|
|
|
EOF
|
|
|
|
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
echo "### Test --shebang-wrap --pipe with parser options stdin"
|
2023-01-29 23:40:56 +00:00
|
|
|
cat /tmp/in12 /tmp/in45 | "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
echo "### Test --shebang-wrap --pipe with parser options Same as"
|
2023-02-03 15:37:25 +00:00
|
|
|
cat /tmp/in12 /tmp/in45 | parallel -k --pipe /usr/bin/perl\ -p "$qscript"
|
2023-01-29 23:40:56 +00:00
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
|
|
|
|
rm /tmp/in12
|
|
|
|
rm /tmp/in45
|
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_perl() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_perl
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/perl
|
|
|
|
|
|
|
|
print "Arguments @ARGV\n";
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_python() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_python
|
|
|
|
cat <<'EOF' > "$script"
|
2020-06-22 22:34:52 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/python3
|
2016-08-13 17:11:15 +00:00
|
|
|
|
|
|
|
import sys
|
2023-01-29 23:40:56 +00:00
|
|
|
sys.argv.pop(0)
|
2020-06-22 22:34:52 +00:00
|
|
|
print('Arguments', str(sys.argv))
|
2016-08-13 17:11:15 +00:00
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_bash() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_bash
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /bin/bash
|
|
|
|
|
|
|
|
echo Arguments "$@"
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_sh() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_sh
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /bin/sh
|
|
|
|
|
|
|
|
echo Arguments "$@"
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_ksh() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_ksh
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/ksh
|
|
|
|
|
|
|
|
echo Arguments "$@"
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_zsh() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_zsh
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/zsh
|
|
|
|
|
|
|
|
echo Arguments "$@"
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_csh() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_csh
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /bin/csh
|
|
|
|
|
|
|
|
echo Arguments "$argv"
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_tcl() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_tcl
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/tclsh
|
|
|
|
|
|
|
|
puts "Arguments $argv"
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_R() {
|
2023-01-29 23:40:56 +00:00
|
|
|
# Rscript fucks up if $TMPDIR contains space
|
|
|
|
TMPDIR=/tmp
|
|
|
|
script="$TMPDIR"/shebang_wrap_R
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/Rscript --vanilla --slave
|
|
|
|
|
|
|
|
args <- commandArgs(trailingOnly = TRUE)
|
|
|
|
print(paste("Arguments ",args))
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
2023-01-29 23:40:56 +00:00
|
|
|
|
2016-08-13 17:11:15 +00:00
|
|
|
par_shebang_wrap_gnuplot() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_gnuplot
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k ARG={} /usr/bin/gnuplot
|
|
|
|
|
2024-05-22 20:55:05 +00:00
|
|
|
print "Arguments ", system('echo "$ARG"')
|
2016-08-13 17:11:15 +00:00
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
2024-05-22 20:55:05 +00:00
|
|
|
stdout "$script" arg1 arg2 "arg3.1 arg3.2" |
|
|
|
|
# Gnuplot 6.0 inserts an extra space
|
|
|
|
perl -pe 's/rguments /rguments /'
|
2023-01-29 23:40:56 +00:00
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_ruby() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_ruby
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/ruby
|
2024-08-04 08:47:04 +00:00
|
|
|
|
2016-08-13 17:11:15 +00:00
|
|
|
print "Arguments "
|
|
|
|
puts ARGV
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_octave() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_octave
|
2023-09-17 02:48:25 +00:00
|
|
|
unset DISPLAY
|
2023-01-29 23:40:56 +00:00
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/octave
|
|
|
|
|
|
|
|
printf ("Arguments");
|
|
|
|
arg_list = argv ();
|
|
|
|
for i = 1:nargin
|
|
|
|
printf (" %s", arg_list{i});
|
|
|
|
endfor
|
|
|
|
printf ("\n");
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
2024-08-04 08:47:04 +00:00
|
|
|
par_shebang_wrap_groovy() {
|
|
|
|
script="$TMPDIR"/shebang_wrap_groovy
|
|
|
|
unset DISPLAY
|
|
|
|
cat <<'EOF' > "$script"
|
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /snap/bin/groovy
|
|
|
|
|
|
|
|
println "Arguments: ${args.join(' ')}"
|
|
|
|
EOF
|
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_racket() {
|
|
|
|
script="$TMPDIR"/shebang_wrap_racket
|
|
|
|
unset DISPLAY
|
|
|
|
cat <<'EOF' > "$script"
|
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/racket
|
|
|
|
#lang racket
|
|
|
|
|
|
|
|
;; Get the command-line arguments, skipping the script name
|
|
|
|
(define args (vector->list (current-command-line-arguments)))
|
|
|
|
|
|
|
|
;; Format the arguments as a string
|
|
|
|
(define formatted-args (string-join args " "))
|
|
|
|
|
|
|
|
;; Print the result
|
|
|
|
(printf "Arguments: ~a\n" formatted-args)
|
|
|
|
EOF
|
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_scheme() {
|
|
|
|
script="$TMPDIR"/shebang_wrap_scheme
|
|
|
|
unset DISPLAY
|
|
|
|
cat <<'EOF' > "$script"
|
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/env guile
|
|
|
|
!#
|
|
|
|
|
|
|
|
(define (print-arguments args)
|
|
|
|
(display "Arguments: ")
|
|
|
|
(for-each (lambda (arg)
|
|
|
|
(display arg)
|
|
|
|
(display " "))
|
|
|
|
args)
|
|
|
|
(newline))
|
|
|
|
|
|
|
|
(print-arguments (cdr (command-line)))
|
|
|
|
EOF
|
|
|
|
chmod 755 "$script"
|
|
|
|
stdout "$script" arg1 arg2 "arg3.1 arg3.2" |
|
|
|
|
grep -v ';;;' | grep -v shebang_wrap_sche
|
|
|
|
rm "$script"
|
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_awk() {
|
|
|
|
script="$TMPDIR"/shebang_wrap_awk
|
|
|
|
unset DISPLAY
|
|
|
|
cat <<'EOF' > "$script"
|
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/awk -f
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
printf "Arguments: "
|
|
|
|
for (i = 1; i < ARGC; i++) {
|
|
|
|
printf "%s ", ARGV[i]
|
|
|
|
}
|
|
|
|
printf "\n"
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_fsharp() {
|
|
|
|
script="$TMPDIR"/shebang_wrap_fsharp.fsx
|
|
|
|
unset DISPLAY
|
|
|
|
cat <<'EOF' > "$script"
|
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/fsharpi
|
|
|
|
|
|
|
|
let args = (System.Environment.GetCommandLineArgs()
|
|
|
|
|> Array.tail |> Array.tail |> Array.tail)
|
|
|
|
printfn "Arguments: %A" args
|
|
|
|
EOF
|
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_julia() {
|
|
|
|
script="$TMPDIR"/shebang_wrap_julia
|
|
|
|
unset DISPLAY
|
|
|
|
cat <<'EOF' > "$script"
|
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /snap/bin/julia
|
|
|
|
|
|
|
|
println("Arguments: ", join(ARGS, " "))
|
|
|
|
EOF
|
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
|
|
|
}
|
|
|
|
|
2016-08-13 17:11:15 +00:00
|
|
|
par_shebang_wrap_clisp() {
|
2023-02-19 13:49:30 +00:00
|
|
|
# clisp cannot handle dirs w/ shell wildcards
|
|
|
|
TMPDIR=/tmp
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_clisp
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/clisp
|
2024-08-04 08:47:04 +00:00
|
|
|
|
2016-08-13 17:11:15 +00:00
|
|
|
(format t "~&~S~&" 'Arguments)
|
|
|
|
(format t "~&~S~&" *args*)
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_php() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_php
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/php
|
|
|
|
<?php
|
|
|
|
echo "Arguments";
|
|
|
|
foreach(array_slice($argv,1) as $v)
|
|
|
|
{
|
|
|
|
echo " $v";
|
|
|
|
}
|
|
|
|
echo "\n";
|
|
|
|
?>
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_nodejs() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_nodejs
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/node
|
|
|
|
|
|
|
|
var myArgs = process.argv.slice(2);
|
|
|
|
console.log('Arguments ', myArgs);
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_lua() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_lua
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k /usr/bin/lua
|
|
|
|
|
|
|
|
io.write "Arguments"
|
|
|
|
for a = 1, #arg do
|
|
|
|
io.write(" ")
|
|
|
|
io.write(arg[a])
|
|
|
|
end
|
|
|
|
print("")
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang_wrap_csharp() {
|
2023-01-29 23:40:56 +00:00
|
|
|
script="$TMPDIR"/shebang_wrap_csharp
|
|
|
|
cat <<'EOF' > "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap -k ARGV={} /usr/bin/csharp
|
|
|
|
|
|
|
|
var argv = Environment.GetEnvironmentVariable("ARGV");
|
|
|
|
print("Arguments "+argv);
|
|
|
|
EOF
|
2023-01-29 23:40:56 +00:00
|
|
|
chmod 755 "$script"
|
|
|
|
"$script" arg1 arg2 "arg3.1 arg3.2"
|
|
|
|
rm "$script"
|
2016-08-13 17:11:15 +00:00
|
|
|
}
|
2012-11-22 11:10:45 +00:00
|
|
|
|
2016-08-13 17:11:15 +00:00
|
|
|
export -f $(compgen -A function | grep par_)
|
|
|
|
# Tested with -j1..8
|
|
|
|
# -j6 was fastest
|
|
|
|
#compgen -A function | grep par_ | sort | parallel -j$P --tag -k '{} 2>&1'
|
2024-05-22 20:55:05 +00:00
|
|
|
compgen -A function | G par_ "$@" | LC_ALL=C sort |
|
|
|
|
parallel -j6 --tag -k '{} 2>&1'
|
2023-01-29 23:40:56 +00:00
|
|
|
rmdir "$TMPDIR" "$tmp"
|