mitchweaver/subs

Single quotes are not needed in SUBS_MENU_PROG setting

an9wer opened this issue · 1 comments

Hi, there is an error occurred in line 215 when I run subs (my /bin/sh is linked to bash which version is 5.0.18):

$ ./subs
./subs: line 215: 'dmenu: command not found
Interrupted

I've install dmenu command, so why does this happen?

But then I noticed the dmenu is prefix with a single quote ('dmenu), I found that the cause of this error is the code in line 24:

: "${SUBS_MENU_PROG:='dmenu -p Subs:'}"

I think there is no need to wrap dmenu command with single quotes here.

Below is my proof:

Start an interactive bash, run with single quotes wrapped:

$ : "${SUBS_MENU_PROG:='dmenu -p Subs:'}"
$ declare -p SUBS_MENU_PROG
declare -- SUBS_MENU_PROG="'dmenu -p Subs:'"

Start ahother interactive bash, run without single quotes wrapped:

$ : "${SUBS_MENU_PROG:=dmenu -p Subs:}"
$ declare -p SUBS_MENU_PROG
declare -- SUBS_MENU_PROG="dmenu -p Subs:"

You are correct, that is an oversight by me! Also needs the -l flag to list vertically.