2012-11-22 11:10:45 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2012-11-22 22:19:00 +00:00
|
|
|
seq 1 2 >/tmp/in12
|
|
|
|
seq 4 5 >/tmp/in45
|
|
|
|
|
2012-11-22 11:10:45 +00:00
|
|
|
echo "### Test basic --shebang-wrap"
|
2012-11-22 22:19:00 +00:00
|
|
|
cat <<EOF > /tmp/basic--shebang-wrap
|
2012-11-22 11:10:45 +00:00
|
|
|
#!/usr/local/bin/parallel --shebang-wrap /usr/bin/perl
|
|
|
|
|
|
|
|
print "Shebang from perl with args @ARGV\n";
|
|
|
|
EOF
|
|
|
|
|
2012-11-22 22:19:00 +00:00
|
|
|
chmod 755 /tmp/basic--shebang-wrap
|
|
|
|
/tmp/basic--shebang-wrap arg1 arg2
|
2012-12-28 20:30:30 +00:00
|
|
|
echo "### Test basic --shebang-wrap Same as"
|
2012-11-22 22:19:00 +00:00
|
|
|
parallel /usr/bin/perl /tmp/basic--shebang-wrap ::: arg1 arg2
|
2012-12-28 20:30:30 +00:00
|
|
|
echo "### Test basic --shebang-wrap stdin"
|
2012-11-22 22:19:00 +00:00
|
|
|
(echo arg1; echo arg2) | /tmp/basic--shebang-wrap
|
2012-12-28 20:30:30 +00:00
|
|
|
echo "### Test basic --shebang-wrap Same as"
|
2012-11-22 22:19:00 +00:00
|
|
|
(echo arg1; echo arg2) | parallel /usr/bin/perl /tmp/basic--shebang-wrap
|
|
|
|
rm /tmp/basic--shebang-wrap
|
|
|
|
|
2012-11-22 11:10:45 +00:00
|
|
|
|
|
|
|
echo "### Test --shebang-wrap with parser options"
|
2012-11-22 22:19:00 +00:00
|
|
|
cat <<EOF > /tmp/with-parser--shebang-wrap
|
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
|
|
|
|
|
2012-11-22 22:19:00 +00:00
|
|
|
chmod 755 /tmp/with-parser--shebang-wrap
|
|
|
|
/tmp/with-parser--shebang-wrap /tmp/in12 /tmp/in45
|
2012-12-28 20:30:30 +00:00
|
|
|
echo "### Test --shebang-wrap with parser options Same as"
|
2012-12-02 20:11:27 +00:00
|
|
|
parallel -k /usr/bin/perl -p /tmp/with-parser--shebang-wrap ::: /tmp/in12 /tmp/in45
|
2012-12-28 20:30:30 +00:00
|
|
|
echo "### Test --shebang-wrap with parser options stdin"
|
2012-11-22 22:19:00 +00:00
|
|
|
(echo /tmp/in12; echo /tmp/in45) | /tmp/with-parser--shebang-wrap
|
2012-12-28 20:30:30 +00:00
|
|
|
echo "### Test --shebang-wrap with parser options Same as"
|
2012-12-02 20:11:27 +00:00
|
|
|
(echo /tmp/in12; echo /tmp/in45) | parallel -k /usr/bin/perl /tmp/with-parser--shebang-wrap
|
2012-11-22 22:19:00 +00:00
|
|
|
rm /tmp/with-parser--shebang-wrap
|
|
|
|
|
|
|
|
|
|
|
|
echo "### Test --shebang-wrap --pipe with parser options"
|
|
|
|
cat <<EOF > /tmp/pipe--shebang-wrap
|
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
|
|
|
|
|
|
|
|
chmod 755 /tmp/pipe--shebang-wrap
|
2012-11-22 22:43:49 +00:00
|
|
|
echo Suboptimal
|
2012-11-22 22:19:00 +00:00
|
|
|
/tmp/pipe--shebang-wrap :::: /tmp/in12 /tmp/in45
|
2012-11-22 22:43:49 +00:00
|
|
|
echo Optimal
|
2012-11-22 22:19:00 +00:00
|
|
|
/tmp/pipe--shebang-wrap /tmp/in12 /tmp/in45
|
2012-12-28 20:30:30 +00:00
|
|
|
echo "### Test --shebang-wrap --pipe with parser options Same as"
|
|
|
|
parallel -k --pipe /usr/bin/perl\ -p /tmp/pipe--shebang-wrap :::: /tmp/in12 /tmp/in45
|
|
|
|
echo "### Test --shebang-wrap --pipe with parser options stdin"
|
2012-11-22 22:19:00 +00:00
|
|
|
cat /tmp/in12 /tmp/in45 | /tmp/pipe--shebang-wrap
|
2012-12-28 20:30:30 +00:00
|
|
|
echo "### Test --shebang-wrap --pipe with parser options Same as"
|
|
|
|
cat /tmp/in12 /tmp/in45 | parallel -k --pipe /usr/bin/perl\ -p /tmp/pipe--shebang-wrap
|
2012-11-22 22:19:00 +00:00
|
|
|
rm /tmp/pipe--shebang-wrap
|
2012-11-22 11:10:45 +00:00
|
|
|
|
2012-11-22 22:19:00 +00:00
|
|
|
rm /tmp/in12
|
|
|
|
rm /tmp/in45
|