#!/bin/bash DIRECTORY="$(readlink -f "$(dirname "$(dirname "$0")")")" file="$6" echo "$file" > "$DIRECTORY/data/current-viewed-logfile" if command -v mousepad ;then mousepad "$file" & pid=$! elif command -v leafpad ;then leafpad "$file" & pid=$! else #for text_editor function source "${DIRECTORY}/api" text_editor "$file" & pid=$! fi while [ "$(cat "$DIRECTORY/data/current-viewed-logfile")" == "$file" ];do sleep 1 done kill $pid 2>/dev/null