summaryrefslogtreecommitdiff
path: root/linkify
diff options
context:
space:
mode:
Diffstat (limited to 'linkify')
-rwxr-xr-xlinkify22
1 files changed, 11 insertions, 11 deletions
diff --git a/linkify b/linkify
index 83f1bc1..625c3e5 100755
--- a/linkify
+++ b/linkify
@@ -6,7 +6,7 @@ if [[ "$#" -lt 1 ]]; then
fi
home=$HOME
-script_dir=`dirname $(realpath $0)`
+script_dir=`dirname $(realpath "$0")`
script_home="$script_dir/home"
fof=0
@@ -15,25 +15,25 @@ files=0
for file in "$@"
do
- if [[ -h $file ]]; then
+ if [[ -h "$file" ]]; then
((links++))
- elif [[ -d $file ]]; then
+ elif [[ -d "$file" ]]; then
echo "$file is directory, skipping"
- elif [[ -f $file ]]; then
- real_path_file=$(realpath $file)
- check_home=$(echo $real_path_file | cut -d'/' -f-3)
+ elif [[ -f "$file" ]]; then
+ real_path_file="$(realpath "$file")"
+ check_home="$(echo "$real_path_file" | cut -d'/' -f-3)"
- if [[ $home = $check_home ]]; then
- relative_path=$(echo $real_path_file | cut -d'/' -f4-)
+ if [[ "$home" = "$check_home" ]]; then
+ relative_path="$(echo "$real_path_file" | cut -d'/' -f4-)"
desired_path="$script_home/$relative_path"
- mkdir -p $(dirname $desired_path)
- mv $file $desired_path
+ mkdir -p "$(dirname "$desired_path")"
+ mv "$file" "$desired_path"
if [[ "$file" == *".fof" ]]; then
cp "$desired_path" "${file::-4}"
((fof++))
else
- ln -s $desired_path $file
+ ln -s "$desired_path" "$file"
((files++))
fi
else