mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-13 20:12:26 +00:00
21 lines
309 B
Bash
Executable File
21 lines
309 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# echo and eval
|
|
a=
|
|
while getopts a OPT; do
|
|
case "$OPT" in
|
|
a)
|
|
# Append to file instead of overwriting.
|
|
a=-a
|
|
;;
|
|
?)
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
shift "$(($OPTIND - 1))"
|
|
cmd="$1"
|
|
outfile="${2:-/dev/null}"
|
|
echo "$cmd" | tee $a "$outfile"
|
|
eval "$cmd"
|
|
exit "$?"
|