dotfiles/.local/bin/scripts/arg-test

16 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