Find the path of a shell command

Weatherby,Gerard gweatherby at uchc.edu
Wed Oct 12 17:25:54 EDT 2022


Some thoughts / notes:
1. On our Ubuntu-Server 20.04.3 based systems, /bin/rm and /usr/bin/rm are hard links to the same file.

2. Put the following in a bash script and run it from cron. Then you can see what your environment is. Mine has PATH=/usr/bin:/bin in it.

#!/bin/bash
env > /tmp/env$$

3. You can background Python just as well as you can a separate rm invocation.
if os.fork() == 0:
                os.unlink(….)








From: Python-list <python-list-bounces+gweatherby=uchc.edu at python.org> on behalf of Grant Edwards <grant.b.edwards at gmail.com>
Date: Wednesday, October 12, 2022 at 5:03 PM
To: python-list at python.org <python-list at python.org>
Subject: Re: Find the path of a shell command
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

On 2022-10-12, 2QdxY4RzWzUUiLuE at potatochowder.com <2QdxY4RzWzUUiLuE at potatochowder.com> wrote:
> On 2022-10-12 at 17:43:18 +0100, Paulo da Silva <p_d_a_s_i_l_v_a_ns at nonetnoaddress.pt> wrote:
>>
>> > Probably you could use os.unlink[1] with no problem.
>>
>> No, because I need to launch several rm's that keep running after the script
>> ends.
>
> rm doesn't take that long.

Recursive ones can take a long time.

--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!ny8-fSGJEE3wk-Yq188xuT5aamgIUVI6SJQHkNaxMp11JelflHEJ2SQcYqqSC1s8pxkifVVdFyeEcbSv1ZJlqoaxuG_m$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!ny8-fSGJEE3wk-Yq188xuT5aamgIUVI6SJQHkNaxMp11JelflHEJ2SQcYqqSC1s8pxkifVVdFyeEcbSv1ZJlqoaxuG_m$>


More information about the Python-list mailing list