dotfiles/.local/bin/scripts/arg-test
2022-09-03 13:37:33 +02:00

15 lines
342 B
Bash
Executable file

#!/bin/sh
outfile=/tmp/args$(date +%s)
# echo "dot - graphviz version 5.0.1 (0)" >&2
{
echo "$# Args: ${@:-DEFAULT}"
#echo "Starred: $*"
#echo "${@:-default}" | sed 's/\w\+/\0-w/g'
for last; do true; done
echo "Last arg: $last"
} | tee "$outfile"
if tty -s || test "$1" = "-V"
then echo "Not reading from stdin"
else tee "$outfile-stdin"
fi