#!/bin/sh jedit file.txt zenity --info ...several more more commands... exit
Expected behavior: I command the script (in this case, via a keyboard shortcut). A jEdit window then opens on my Xfce4 desktop, displaying the contents of file.txt. I perform some text manipulation within same and then manually close said jEdit window. Next, the commanded Zenity window appears, as expected. I close same manually and the next step of the script executes...and I experience joy and contentment.
However, if, for some reason I've already got an unrelated jEdit window open on the desktop when I command the script (again, via a keyboard shortcut), here's what now happens: After said script is so commanded, the expected jEdit window (the one displaying the contents of file.txt) opens, along with the Zenity window (note that, in this case, said Zenity window opens before the jEdit window is manually closed by me). This is undesired behavior...and I experience rage and despair.
I have tried many things, including the
wait command and appending the
terminal line with
&&. I've also attempted trapping. Nothing is working for me.
What is causing this to happen and how can I remedy it?