[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tests: dis/allow '.' in PATH?
From: |
Paul Eggert |
Subject: |
Re: tests: dis/allow '.' in PATH? |
Date: |
Wed, 24 Nov 2021 15:54:36 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 |
On 11/24/21 15:03, Bernhard Voelker wrote:
Sure, the attached is an approach with shell tools
Can't this be done without using any subsidiary commands?
Something like the following untested code. This removes all relative
names from PATH, not just '.'.
saved_IFS=$IFS
IFS=:
new_PATH=
for dir in $PATH; do
case $dir in
/*) new_PATH=$new_PATH${new_PATH:-:}$dir;;
esac
done
IFS=$saved_IFS
PATH=$new_PATH