-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Would this be a case for "ps"?

If you would like to know the PID of the process that calls your script you 
could execute "ps -o
comm= $PPID"

https://pubs.opengroup.org/onlinepubs/009604499/utilities/ps.html

Rudi

November 11, 2019 5:34 PM, "Jack" <ostrof...@users.sourceforge.net> wrote:

> On 11/11/19 12:38 PM, Walter Dnes wrote:
> 
>> On Mon, Nov 11, 2019 at 04:37:17AM +0000, Caveman Al Toraboran wrote
> 
> hi - is it possible to have some kind of fancy links that
> know the name of the process that is trying to access
> it, and based on its name, it links it to a file?
>> Short answer... YES! Now convince the developers to use it. Here's a
>> trivial example...
>> 
>> * Create a 2-line executable script "foo"
>> #!/bin/bash
>> echo "${0}"
>> 
>> * Create a symlink with the command "ln -s foo bar"
>> 
>> * Execute "./foo" and the output will be "./foo"
>> 
>> * Execute "./bar" and the output will be "./bar"
> 
> That makes a distinction based on the name by which the script was called, 
> not on the name of the
> calling script. Caveman Al, have I misunderstood what your are asking for?
> 
> Jack
-----BEGIN PGP SIGNATURE-----
Version: Keybase OpenPGP v2.1.3
Comment: https://keybase.io/crypto

wsFcBAABCgAGBQJdyq9EAAoJEO9k88vRoevdQLUP/RTw4j7pwVpehYcElbrJ1KdI
5W9Jyx2x8rr3JQz0s3YYehp/WZITKWLiIj4ho3FuHXWRVr+4ncl1s2NMJ9FR2GLV
aquB4G+6t4n0dUIiVOKXnIl9vT9fRvS3yLby77dO9mMdoU6EjUSSYFxLC1F51rpj
FjrF2wiT3aGb0lEunEF2ZGMXwoLCbRw88bfovFq4CiU5nteMBfcbp/FH0X9nyyEJ
eL8855Jojd+KZLazJEKpGQob2dzvJQ/l9KE1dLy2NUu57OSBIh20WsZoAN89G7dR
DWG70ywdivTpMmHooegpRxbMXrDZx662iSnWcERddG2vcirIisYhhlh8qgQYn83n
Q/HSvKDp/o+kkkav25TYiKUBV6nT/t6WvFbXoz8WDJKErFbMBobBD8H3mqclL4OF
3nyXVniD2dfVeR/pGu1U0iI5+kLBt+GKv7l01LhfenOF/Hsm0qAbaH+523BggCMH
Ak6/Ec3GU7qV5QNAqdFFlpvIP3VzfbTHEaDDbPfSBAENJD7GrBfUanxFtIs9LpS8
JtJKC/b/CWiK0jnAGe6yC8yqRb5qjtz60GWSFZPKVoSdwdsMlIJ4XmmLZHDtncQh
87BiEG2Tt3QobekaYqv6/fGA7g6tn9xAZWQpgpImM8kDAlLFtBr4uTa4Fq9V/hFI
qVwD3XtUKn+TD0vC+cYc
=loNt
-----END PGP SIGNATURE-----

Reply via email to