2010-07-09 12:10:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-12-26 22:29:28 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-2022 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
|
|
|
|
|
2013-12-05 23:21:21 +00:00
|
|
|
rm -f ~/.parallel/will-cite
|
|
|
|
|
2018-01-25 02:48:16 +00:00
|
|
|
resize=`resize`
|
|
|
|
|
2015-06-14 21:43:58 +00:00
|
|
|
# Disabled 2015-06-01
|
|
|
|
#
|
|
|
|
# echo '### Test stdin goes to first command only ("-" as argument)'
|
|
|
|
# cat >/tmp/parallel-script-for-script <<EOF
|
|
|
|
# #!/bin/bash
|
|
|
|
# echo via first cat |parallel --tty -kv cat ::: - -
|
|
|
|
# EOF
|
|
|
|
# chmod 755 /tmp/parallel-script-for-script
|
|
|
|
# echo via pseudotty | script -q -f -c /tmp/parallel-script-for-script /dev/null
|
|
|
|
# sleep 2
|
|
|
|
# rm /tmp/parallel-script-for-script
|
2015-02-01 13:38:26 +00:00
|
|
|
|
2021-04-22 16:20:41 +00:00
|
|
|
echo '### Test xargs compatibility'
|
|
|
|
|
|
|
|
echo /tmp/1 > /tmp/files
|
|
|
|
echo 1 > /tmp/1
|
|
|
|
|
|
|
|
echo 'xargs Expect: 3 1'
|
|
|
|
echo 3 | xargs -P 1 -n 1 -a /tmp/files cat -
|
|
|
|
echo 'parallel Expect: 3 1 via psedotty 2'
|
|
|
|
cat >/tmp/parallel-script-for-script <<EOF
|
|
|
|
#!/bin/bash
|
|
|
|
echo 3 | parallel --tty -k -P 1 -n 1 -a /tmp/files cat -
|
|
|
|
EOF
|
|
|
|
chmod 755 /tmp/parallel-script-for-script
|
2021-05-22 23:18:09 +00:00
|
|
|
echo via pseudotty |
|
|
|
|
script -q -f -c /tmp/parallel-script-for-script /dev/null |
|
|
|
|
perl -ne '/tange| .*/ or print'
|
2021-04-22 16:20:41 +00:00
|
|
|
sleep 1
|
|
|
|
|
|
|
|
echo 'xargs Expect: 1 3'
|
|
|
|
echo 3 | xargs -I {} -P 1 -n 1 -a /tmp/files cat {} -
|
|
|
|
echo 'parallel Expect: 1 3 2 via pseudotty'
|
|
|
|
cat >/tmp/parallel-script-for-script2 <<EOF
|
|
|
|
#!/bin/bash
|
|
|
|
echo 3 | parallel --tty -k -I {} -P 1 -n 1 -a /tmp/files cat {} -
|
|
|
|
EOF
|
|
|
|
chmod 755 /tmp/parallel-script-for-script2
|
2021-05-22 23:18:09 +00:00
|
|
|
echo via pseudotty |
|
|
|
|
script -q -f -c /tmp/parallel-script-for-script2 /dev/null |
|
|
|
|
perl -ne '/tange| .*/ or print'
|
2021-04-22 16:20:41 +00:00
|
|
|
sleep 1
|
|
|
|
|
2010-09-05 10:22:08 +00:00
|
|
|
echo '### Test stdin goes to first command only ("cat" as argument)'
|
|
|
|
cat >/tmp/parallel-script-for-script2 <<EOF
|
|
|
|
#!/bin/bash
|
2012-01-08 18:52:00 +00:00
|
|
|
echo no output |parallel --tty -kv ::: 'echo a' 'cat'
|
2010-09-05 10:22:08 +00:00
|
|
|
EOF
|
|
|
|
chmod 755 /tmp/parallel-script-for-script2
|
2020-05-23 18:04:09 +00:00
|
|
|
echo via pseudotty |
|
|
|
|
script -q -f -c /tmp/parallel-script-for-script2 /dev/null |
|
|
|
|
perl -ne '/tange| .*/ or print'
|
2010-09-14 16:37:26 +00:00
|
|
|
sleep 2
|
2015-02-01 13:38:26 +00:00
|
|
|
rm /tmp/parallel-script-for-script2
|
2014-07-14 16:25:45 +00:00
|
|
|
|
2015-03-08 09:37:49 +00:00
|
|
|
echo "### Test stdin as tty input for 'vi'"
|
|
|
|
echo 'NB: If this changes and the diff is printed to terminal, then'
|
|
|
|
echo "the terminal settings may be fucked up. Use 'reset' to get back."
|
|
|
|
cat >/tmp/parallel-script-for-script3 <<EOF
|
|
|
|
#!/bin/bash
|
|
|
|
seq 10 | parallel --tty -X vi file{}
|
|
|
|
EOF
|
|
|
|
chmod 755 /tmp/parallel-script-for-script3
|
2020-05-23 18:04:09 +00:00
|
|
|
echo ZZZZ |
|
|
|
|
script -q -f -c /tmp/parallel-script-for-script3 /dev/null |
|
|
|
|
perl -ne '/tange| .*/ or print'
|
2015-03-08 09:37:49 +00:00
|
|
|
sleep 2
|
|
|
|
rm /tmp/parallel-script-for-script3
|
|
|
|
|
2020-05-23 18:04:09 +00:00
|
|
|
stdout parallel --citation < /dev/null |
|
|
|
|
perl -ne '/tange| .*/ or print'
|
2016-04-11 20:19:28 +00:00
|
|
|
|
2014-07-14 16:25:45 +00:00
|
|
|
touch ~/.parallel/will-cite
|
2018-07-22 06:58:32 +00:00
|
|
|
echo 1 > ~/.parallel/runs-without-willing-to-cite
|
2018-01-25 02:48:16 +00:00
|
|
|
# Clear screen
|
|
|
|
eval `resize`
|
|
|
|
seq $LINES | parallel -N0 echo > /dev/tty
|
2017-01-12 22:36:15 +00:00
|
|
|
reset
|