commit 7fed03c

hovercats  ·  2023-11-22 10:07:00 +0000 UTC
parent 8297ab7
bmks: use XDG_CONFIG_HOME to not interfere with users preferences | add some missing brackets
1 files changed,  +5, -5
+5, -5
 1@@ -2,16 +2,16 @@
 2 
 3 # A simple bookmarking script that uses dmenu
 4 
 5-file_path="$HOME/etc/bmks"
 6+file_path="${XDG_CONFIG_HOME}/bmks"
 7 filename=urls
 8-bookmarks="$file_path/$filename"
 9+bookmarks="${file_path}/${filename}"
10 
11 usage() {
12     printf "Usage: bmks a|d|l\n"
13 }
14 
15 add() { 
16-	[ -z "$url" ] && printf "Error: url must be provided\n" && exit 1
17+	[ -z "${url}" ] && printf "Error: url must be provided\n" && exit 1
18 	printf "Description: "
19 	read -r description
20 	[ -z "${description}" ] && echo "${url}" >> "${bookmarks}"
21@@ -37,8 +37,8 @@ del() {
22 	sed "/$(sort "${bookmarks}" | dmenu -c -i -l 10)/d" "${bookmarks}" > _ && mv -f _ "${bookmarks}"
23 }
24 
25-[ ! -d "$file_path" ] && mkdir -p "$file_path"
26-[ ! -f "$filename" ] && touch "$file_path/$filename" 
27+[ ! -d "${file_path}" ] && mkdir -p "${file_path}"
28+[ ! -f "${filename}" ] && touch "${file_path}/${filename}" 
29 
30 case "$1" in
31 	h) usage ;;