1
0
Fork 0

needs work, but tee implemented in sh

This commit is contained in:
dtb 2024-01-15 14:23:54 -07:00
parent f2d788e85f
commit f4011d25a7
1 changed files with 21 additions and 0 deletions

21
mm/tee Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
while getopts :ai c
do case "$c" in
a) line="$(printf '%s -a ' "$line")" ;;
i) line="$(printf '%s -n ' "$line")" ;;
*) printf 'Usage: %s (-ai) (file...)\n' "$0"
exit 64 # sysexits(3) EX_USAGE
esac
done
shift "$(printf '%s - 1\n' "$OPTIND" | bc)"
line="$(printf '%s -o - ' "$line")"
for file in "$@";
do >"$file"
line="$(printf '%s -o %s ' "$line" "$file")"
done
exec mm $line