Also, 

`id -u` to get current UID

`ps -o uid -p $PID | awk 'END{print $1}'` to get the UID owning process ID 
$PID. 

These work on at least Solaris and Linux, and probably many others. 

--Robert

> On Jul 31, 2017, at 18:49, Ivan Vučica <i...@vucica.net> wrote:
> 
> 
> 
>> On Mon, Jul 31, 2017 at 11:16 PM Bertrand Gmail 
>> <bertrand.dekoni...@gmail.com> wrote:
>> Le 31/07/2017 à 20:02, Steven R. Baker a écrit :
>> > Any chance you could document your setup with screenshots and code? A
>> > blog, perhaps? Or a video? This overlaps *very much* with some stuff
>> > I'm doing right now, and I'd love to see what you've got, and what's
>> > left.
>> >
>> I'll try to put screenshots/cats  somewhere if I can.
>> You can see one screenshot here :
>> https://raw.githubusercontent.com/BertrandDekoninck/rik.theme/master/newscreen.png
>> Iattach my autostart file here and the code of my little topbar GSPanel
>> is on my github repo : https://github.com/BertrandDekoninck. But it's
>> nothing more than a bar with a label and a button.
>> 
>> Bertrand Dekoninck
> 
> This is absolutely beautiful. I'll have to install Rik. I'd also love to hear 
> more about the rest of the setup: how do I go from a blank home folder of a 
> newly installed ${favorite_distro} to your UX.
>  
>> 
>> PS : maybe some bash expert could tell in another thread how to track
>> the owner of a process in bash. My autostart file can avoid to launch
>> processes (like gnome-settings-daemon) if it runs already but it should
>> be launched if the running one had been launched by another user than $USER.
> 
> What do you mean by owner?
> 
> If you are interested in user under which the current process is running... 
> why not $USER? It's a reasonable approximation. Also $LOGNAME. I don't know 
> how much either of these is portable.
> 
> Alternatively /proc/self is full of useful things under Linux.
> 
> There's /proc/self/loginuid which gives you, well, login user's ID as far as 
> I can tell (501 is the correct value for me). Use 'getent passwd 501' to map 
> that to the username.
> 
> If you meant 'parent process', look at  /proc/self/stat which gives you 
> current process id and parent process ID.
> 
> Example contents:
> 2867 (bash) S 2866 2867 2867 34836 ....and more here...
> 
> 2867 is ID of the examined process.
> 2866 was for me parent ID. So I'd say this is how you get parent ID.
> 
> More human readable version seems to be /proc/self/status where you can find 
> the parent in "PPid".
> 
> Is either of these what you meant?
>  
>> _______________________________________________
>> Discuss-gnustep mailing list
>> Discuss-gnustep@gnu.org
>> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to