-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunc.sh
More file actions
executable file
·34 lines (30 loc) · 804 Bytes
/
Copy pathfunc.sh
File metadata and controls
executable file
·34 lines (30 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /bin/bash
linkOrWarn() {
if [[ -e "$2" && ! -L "$2" ]]; then
echo -e "\tWarning: $2 already exists and is not a symbolic link. Compare for" \
"differences, merge differences if necessary, and then delete."
else
echo -e "\tLinking $2 to $PWD/$1"
ln -fns $PWD/$1 $2
fi
}
mkdirAndEcho() {
echo -e "\tMaking directory $1"
mkdir -p $1
}
removeOrWarn() {
if [[ -e "$1" && ! -L "$1" ]]; then
echo -e "\tWarning: $1 is not a symbolic link and will not be deleted."
else
echo -e "\tRemoving $1"
rm $1
fi
}
rmdirOrWarn() {
if [ "$(ls -A $1)" ]; then
echo -e "\tWarning: directory $1 is not empty and will not be deleted."
else
echo -e "\tRemoving directory $1"
rmdir $1
fi
}