1
0
Fork 0

more work on tee and also a cat too

This commit is contained in:
dtb 2024-01-15 14:26:23 -07:00
parent d46a6aac3c
commit cb3dac04e9
2 changed files with 18 additions and 1 deletions

17
mm/cat Executable file
View File

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

2
mm/tee
View File

@ -4,7 +4,7 @@ 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"
*) printf 'Usage: %s (-ahi) (file...)\n' "$0"
exit 64 # sysexits(3) EX_USAGE
esac
done