if [ -z "$1" ]; then
echo "#!/bin/bash
-" >"$SCRIPTNAME"
+" | tee "$SCRIPTNAME"
fi
case "$ADDCHOICE" in
edit*)
echo "editing script"
echo "# instantOS quickmenu script" >>"$SCRIPTNAME"
- st -e nvim -c ":e $(realpath $SCRIPTNAME)"
+ st -e nvim -c ":e $(realpath "$SCRIPTNAME")"
;;
options)
echo "#!/bin/bash" >"$SCRIPTNAME"
remove*)
echo "removing entry"
REMOVECHOICE="$(ls -p | instantmenu -bw 4 -C -l 7 -w -1)"
- if [ -d "$REMOVECHOICE" ] && [ -n "$(ls $REMOVECHOICE/)" ]; then
+ if [ -d "$REMOVECHOICE" ] && [ -n "$(ls "$REMOVECHOICE/")" ]; then
imenu -m "category is not empty"
exit
elif ! [ -e "$REMOVECHOICE" ]; then
fi
if imenu -c "remove $REMOVECHOICE"; then
- if [ -d $REMOVECHOICE ]; then
+ if [ -d "$REMOVECHOICE" ]; then
rm -rf "$REMOVECHOICE"
else
rm "$REMOVECHOICE"
imenu -m "selection $EDITCHOICE invalid"
exit
fi
- st -e nvim -c ":e $(realpath $EDITCHOICE)"
+ st -e nvim -c ":e $(realpath "$EDITCHOICE")"
;;
rename*)
echo "renaming entry"
chmod +x "$QUICKCHOICE"
st -e bash -c "$QUICKCHOICE $QUICKARGS"
else
- bash "$QUICKCHOICE" $QUICKARGS
+ bash "$QUICKCHOICE" "$QUICKARGS"
fi
;;