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:
parent
5b8b5a1ae2
commit
76cbf50392
15
.bashrc
15
.bashrc
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user