1
0
mirror of https://github.com/meineerde/dotfiles.git synced 2026-02-05 16:43:22 +00:00

Better variable quoting in delink function

This commit is contained in:
Holger Just 2025-01-22 00:21:35 +01:00
parent 5b8b5a1ae2
commit 76cbf50392

15
.bashrc
View File

@ -3,15 +3,18 @@
# Function to resolve soft links
function delink()
{
f=$1
local f="$1"
local ls link
while [[ -h "$f" ]]; do
ls=`ls -ld "$f"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then f="$link"
else f=`dirname "$f"`/"$link"
ls="$(ls -ld "$f")"
link="$(expr "$ls" : '.*-> \(.*\)$')"
if expr "$link" : '/.*' > /dev/null; then
f="$link"
else
f="$(dirname "$f")/${link}"
fi
done
echo $f
echo "$f"
}
# General Settings