When there is no "watch" ...
... simply use
while : ; do echo "My command here"; sleep 2; clear; done
or more sophisticated as function to put in .bashrc
function watch() {
local args
local time=1
for args in "$@"; do
case "$1" in
-n)
time=$2
shift 2;;
esac
done
local infoStr="Every ${time}.0s: "$@"\t${HOSTNAME}: "
clear
if [ $# -eq 1 ] ; then
while : ; do echo -e -n "$infoStr"; date; sh -c "$@"; sleep $time; clear; done
else
while : ; do echo -e -n "$infoStr"; date; "$@"; sleep $time; clear; done
fi
}
to watch for you. 😉 #bash #.bashrc
Dieser Beitrag wurde bearbeitet. (3 Jahre her)