Pre-set Global Variables

Lubuntu 24.04 LTS

sh -c 'scrot -o /tmp/clip_$(id -u) -e 'xclip -selection clipboard -t image/png < $f''

Are global variables now the same as they were in 22.04?
Which manpages are they specified in?

To the best of my knowledge, there is no significant change in “global variables” between Lubuntu 22.04 and 24.04.
The command you mentioned relies on scrot’s own behavior: the $f variable is a special variable passed by scrot to the command given with the -e option, not a system-wide environment variable.
This is documented in man scrot, while general environment variables are documented in man environ and have not changed in any notable way between these releases.

If you are seeing different behavior or an actual issue on 24.04, it would be best to fill out the support template below so others can help more accurately.

Ubuntu Support Template

**Ubuntu Version**:
Example: 22.04 LTS, 24.04, 25.10

**Desktop Environment (if applicable)**:
Example: GNOME, KDE Plasma, XFCE, Budgie, etc.

**Problem Description**:
Describe what you’re trying to do and what happens instead.
If you can easily reproduce the problem, include the steps so others can try.

Example:

Open Settings → Displays
Try to change resolution
Screen goes black

**Relevant System Information**:
Include any details that might help (e.g., hardware, drivers, or special configurations).

**Screenshots or Error Messages**:
If applicable, paste error messages or screenshots.
We prefer copy-pasted text and screenshots instead of photos of screens.

For multi-line text or logs, wrap them in triple backticks like this or highlight the text and use </> in the composer:

`sudo dmesg | tail -20`

**What I’ve Tried**:
List the solutions or workarounds you’ve already attempted.

**Before Posting**:
:mag: Please check if similar issues have already been reported and resolved.

:blue_book: See the “Start here” guide:
https://discourse.ubuntu.com/t/welcome-to-support-and-help/49951
1 Like

Actually, I’m noticing compromised result’s instead of the expected usual result’s which I had on 22.04.

This is more of “grasping at straws” trying to find the real issue so I can correct it as well as my “less than best” practices.

Although I don’t understand the question being asked, there is something noticed that might be causing an issue:

Is the quoting in this command really what you intend?

As written, it will run sh with the following 6 arguments (which I’ve separated by newlines for visual clarity):

-c
'scrot -o /tmp/clip_$(id -u) -e 'xclip
-selection
clipboard
-t
image/png

and the following redirection

<
$f

where $f will be substituted with whatever the f variable is set to in the shell where this command is being run (or empty string if $f is not set).

Did you intend this? -

sh -c 'scrot -o /tmp/clip_$(id -u) -e '\''xclip -selection clipboard -t image/png < $f'\'
2 Likes

Thanks for that info.
The command in question is actually a “shortcut key” passed to me from another Lubuntu user on ubuntuforums.org who requested his account be closed upon his departure.

He said, “not everybody agree’s with his ways of doing things”.

I suspect his current user name here on discourse, but I don’t intend to bother him about it.

My inquiry here is about the differences between how it worked in previous 22.04 as compared to its compromised fuction now.
(at least on my desktop; I believe its more about dependencies rather than inside distributed Lubuntu)

It’s a “windows-like fuction” using the “PrtScr” key.

And now the “shortcut key” don’t have the same result as before.
In this, I only have current documentation, which I didn’t research the “why and how” of the key while the chance was available.

I believe it used Qlipper, but I’m not yet ready to confirm or discredit that belief.
(As the key itself mentions xclip and also scrot.)
(xclip and qlipper may share some dependants or dependencies :confused: )

1 Like

Thanks for clarifying.

So in previous 22.04, this command
took a screenshot and copied it to clipboard?

And in 24.04
what specific “compromised function” does it now do instead?
What happens if you manually run the command in Terminal?
Does changing the quoting per my previous post make any difference?

It’s a “shortcut key” spec.
Should I check how it functions being ran through terminal?
At least in a “dry-run” scenario?

Yes exactly :+1: copy+paste the command to run it in terminal instead of running it via the shortcut key, and see what happens

1 Like
sh -c 'scrot -o /tmp/clip_$(id -u) -e 'xclip -selection clipboard -t image/png < $f''

I never tried running a shortcut key in a terminal as a simulated dry-run.
-s or --dry-run

where would I put that?
Should I use apt or apt-get
or something other?
This is a new thing for me.

Dry-run’s aren’t whats new to me
but dry-running a shortcut key
that’s whats new to me.

Not as a dry-run. Just actually run the command in Terminal and see what happens. This command is harmless and non-destructive, right?

Running this command in Terminal is the same thing as running it via shortcut key, the terminal just provides more options to observe and control the command’s behavior.

1 Like

Oh ok

By the way, what did you mean by “changing the quoting”?
Did you mean changing the quoting from what I was using before to what you had coded at the end of that post?
I just didn’t know it was completely harmless and non-destructive at all.
I know as a shortcut key it is actually harmless and non-destructive.

Bingo. If the command does not behave as expected when you run it in Terminal (i.e. it doesn’t do what is supposed to happen when you press the shortcut key), then try the command as coded at the end of post #4.

1 Like

In a terminal


sh -c 'scrot -o /tmp/clip_$(id -u) -e 'xclip -selection clipboard -t image/png < $f''

And terminal says


1 Like

The command at the bottom of post 4

Didnt display at the end
wyatt@wyatt-82xb:~$


And terminal says


That usually means the command is “stuck”. What’s the Lubuntu/LXQt equivalent of gnome-system-monitor’s “All Processes” / “Show Dependencies”? Check the process tree in case it looks clear which specific process is stuck (is it sh, scrot, or xclip?), then does pressing Ctrl+C in the stuck terminal to send the processes SIGINT get the processes to quit & the shell return to the prompt?

setting to “Screen shot” in “Shortcut keys” the proposed code in post 4 had no improved output.

###================================================================###

That is correct.
I used the “full-screen” procedure’s from the other Lubuntu user I mentioned who also provided the “shortcut key”.
It worked as expected in 22.04.

There is one part in the following that I took out because I never used it in my particular case.
(provided to show available key strokes as per relevance to the current matter)

And this command to the "Alt-PrtScr" key:
sh -c 'scrot -o -u /tmp/clip_$(id -u) -e 'xclip -selection clipboard -t image/png < $f''

###================================================================###

When pasting the “full-screen” screenshot into the graphics editor (I use kolourpaint)

It acts as if I used the “Alt-PrtScr” command in the “PrtScr” command spot within “Shortcut keys”.
And the paste within kolourpaint isn’t usable as before

###================================================================###

done
suggester says “stuck”

###================================================================###

default
screengrab

from
sh -c ‘scrot -o /tmp/clip_$(id -u) -e ‘xclip -selection clipboard -t image/png < $f’’

to
sh -c 'scrot -o /tmp/clip_$(id -u) -e ‘'‘xclip -selection clipboard -t image/png < $f’'’

###================================================================###

ok
what all still needs to be tried so far
lets see


Just a passing idea

Would it be wise to see how it might “perform” in a live session?

Am I missing anything?

Is the below all that is left to perform now?

Sorry, I misunderstood this because the forum software messed the formatting :frowning: To avoid this problem with terminal output, please type a line of only three backticks before and a line of only three backticks after, like this -

```
paste terminal output here
```

What you got is the “secondary” shell prompt from the bash shell you were trying to run the command in, because I added an erroneous extra trailing single quote :person_facepalming: Apologies. Fixing post #4 now


1 Like

ok
let me try that part again
lemme know when its ready