Check if file still exists after link check
This commit is contained in:
parent
e977a55a7b
commit
e0917ffebc
|
@ -4,15 +4,19 @@ function command_exists {
|
||||||
command -v "$1" &> /dev/null
|
command -v "$1" &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# log to a central logfile (specified by its caller globally)
|
||||||
function do_log {
|
function do_log {
|
||||||
printf "[%s] %s: %s" "$(`basename $BASH_SOURCE`)" "`date`" "$1" >> $logfile
|
printf "[%s] %s: %s" "$(`basename $BASH_SOURCE`)" "`date`" "$1" >> $logfile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if a symlink exists before trying to create it
|
||||||
function do_link {
|
function do_link {
|
||||||
if [ -h "$2" ]; then
|
if [ -h "$2" ]; then
|
||||||
rm "$2"
|
rm "$2"
|
||||||
fi
|
fi
|
||||||
|
if [ ! -e "$2" ]; then
|
||||||
ln -sf "$1" "$2"
|
ln -sf "$1" "$2"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim:set ft=zsh:
|
# vim:set ft=zsh:
|
||||||
|
|
Loading…
Reference in a new issue