I understand that it may be a rare situation for an executable to have spaces in it, but it could happen.
An example may be the best explanation..
Using standard tools, I want to determine the location (on the file system) of the executable which owns(?) the current window...
- get the current window ID ...(
- use the ID to get the PID ...(
wmctrl-p -l | sed ... ID ....
- use the PID to get the executable's name ... (
ps-A ... here is where I run into problems !
ps, when listing only the executable's name (
-o ucmd), it truncates the name to 15 characters, so this rules out this option for any name which is longer.
Widening the column (
-o ucmd:99 ) makes no difference.. If
pgrep is anything to go by, its matching is limited to 15 because of
stat (see: info pgrep)..
Listings in variants of "full" mode (eg
-A w w) are not useful when the name concerned has spaces in it, because this name is separated from its args by another space!.. Also, in "full" mode, if the process was started by a link, the name of the link is shown, rather than the executable's name.
Is there some way to do this (using standard tools)? ...or are spaces a show stopper here?