0

In a code review on Final look at my Lightshot print screen Linux handler POSIX shell script, specifically in this short answer, it has been pointed out to me, that if there are multiple X servers served (simply put, a real multi-user environment), my simple test for PID of a Lightshot.exe executable with pgrep -o Lightshot.exe could be wrong, however slight chance of this I can see happening...

I now came up with the following:

#-o, --oldest: least recently started
#-u, --euid  : match by effective UID
pgrep Lightshot.exe -o -u "$( id -u )"

Am I on the right track? If not, can you help me with better approach?

5
  • Carrying over the conversation from the now deleted Stack Overflow post ;) ... There are e.g. KSnip and flameshot which have a pretty heavy feature set (most of which I wouldn't be interested in). I can't imagine what other features lightshot might bring that would make me want to install wine and a windows program on my machine just for that ... ;) Commented Oct 11 at 18:53
  • @tink I am a heavy screenshot user, and I use Flameshot too, as it has some other features I need. Cheers Commented Oct 11 at 19:07
  • Did you try scrot? Simple and powerful for scripting! I use them for creating animated gifs, with netpbm and gifsicle like tthis: Progress Parallel Grep and How to add progressbar in bash Commented Oct 12 at 7:27
  • Ah, and... have a look at obs-studio ! Commented Oct 12 at 7:32
  • Regarding your pgrep prtoblem, As POSIX environment should hold a $UID variable, you could try: pgrep -u $UID Lightshot.exe or ps U $UID ho pid,comm | sed -ne 's/ Lightshot.exe//p' Commented Oct 12 at 8:24

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.