Trouble Expanding Variable in Shell Script

My goal is to have Emacs w3m open current Safari page

Somehow instead of sending the variable it send literal string $KMVAR_SafariURL

Thank you :slight_smile:

1 Like

Because the $KMVAR is inside a single quoted string (it is also inside double quotes, but that is irrelevant).

Change it to something like:

/usr/local/bin/emacsclient -e '(w3m-browse-url "'"$KMVAR_SafariURL"'")'

So you have a single quoted string '(w3m-browse-url "' (which itself ends in a double quote), and then a double quoted string "$KMVAR_SafariURL" (containing the variable, and hiding any spaces or other characters inside the double quotes), and then a single quoted string '")' (which starts with a double quote).

Sweet, it work really well. Thank you !!

1 Like