Posts

Showing posts from October, 2023
Testing code block #!/bin/dash # check if it is run as ROOT and exit the code. ROOID=$(id -u) if [ $((ROOID)) -eq 0 ]; then notify-send "clean exit" "Oop! it was run as ROOT. please run it as NORMAL user again." exit 0 fi # check if it is running in terminal. otherwise exit. case "$(ps -o stat= -p $$)" in *+*) clear; echo "\ndamshote continue..." ;; *) notify-send -t 2700 "clean exit" "please run it in terminal." ;; esac # check it is already running and exit. SCRIPTNAME="$(dirname -- "$0")" if pidof -x "$SCRIPTNAME" > /dev/null 2>&1; then echo "Oop! it is already running. clean exit" exit 0 fi HEREDIR="$(dirname "$(readlink -f "$0")")" NOTEDIR=""$HEREDIR"/damshote-notes-dir" TRASHDIR=""$HEREDIR"/damshote-trash-dir" mkdir -p "$NOTEDIR" mkdir -p "$TRASHDIR" G...