war() {
war_do() {
clear;
the_time=$(date +%H:%M:%S)
start=$(date +%s.%N)
# Run the command that was provided as argument
eval $@;
rc=$?
end=$(date +%s.%N)
diff=$(echo "${end} - ${start}" | bc)
if [ $rc -eq 0 ]; then
echo ""
echo -e "\e[2m[${the_time}]\e[0m \e[1;32m** Successful **\e[0m \e[2m(time: ${diff} seconds)\e[0m"
else
echo ""
echo -e "\e[2m[${the_time}]\e[0m \e[1;31m** Failed **\e[0m"
fi
sleep 1;
}
war_do $@
while inotifywait -qq .; do
war_do $@
done
}