Closed lskatz closed 2 years ago
Hi
Thank you for your interest and encouragement.
You are refering to the following lines to read the command line (program and arguments) of a screen window. With this code I wanted to get the command line arguments in a secure way.
WINDOW_CL="$(xargs -0 printf "%q " </proc/${WINDOW_PID}/cmdline | \
sed -e 's/ \+$//g')"
According to man printf
(see) the printf "%q"
prints a "format that can be reused as shell input, escaping non-printable characters with the
proposed POSIX $'' syntax."
Apparently, however, this possibility is not implemented in all Linux distributions. Which Linux distribution do you use? Do you know a better way to achive this functionality?
I wrote a version without using printf "%q"
. Can you check if this is working on your machine?
You find that version in the branch "shell-escape".
I get a different error unfortunately
[gzu2@monolith3 screen-save]$ screen-save ANI ./tmp.save
/scicomp/home-pure/gzu2/src/screen-save/screen-save: line 58: ${i@Q}: bad substitution
/scicomp/home-pure/gzu2/src/screen-save/screen-save: line 58: ${i@Q}: bad substitution
[gzu2@monolith3 screen-save]$ screen -ls
There are screens on:
29814.ANI (Detached)
64111.NWSS (Detached)
63857.NWSS2 (Detached)
3 Sockets in /var/run/screen/S-gzu2.
I have adjusted the script again and omitted to use "${i@Q}". Does it work now?
However, I would be interested to know which bash, screen and OS version you are using:
bash --version
screen --version
uname -a
Thank you for this amazing repo. I get an error in the
xargs
invocationWhat is it supposed to do so that we can fix it? Thank you!