salman-abedin / devour

X11 window swallower
GNU General Public License v2.0
415 stars 30 forks source link

Handle args with spaces, remove second shell #8

Closed Abbotta4 closed 4 years ago

Abbotta4 commented 4 years ago

from gnu.org:

($*) Expands to the positional parameters, starting from one. When the expansion is not within double quotes, each positional parameter expands to a separate word. In contexts where it is performed, those words are subject to further word splitting and pathname expansion. ($@) ... When the expansion occurs within double quotes, and word splitting is performed, each parameter expands to a separate word. That is, "$@" is equivalent to "$1" "$2" ….

$* here does not handle arguments with spaces in them, e.g. devour mpv a\ video\ with\ spaces.mp4, but "$@" does.

$SHELL -c "foo" spawns another shell process, which uses more resources than is necessary. Using the same shell process that is running the script should work just fine.

salman-abedin commented 4 years ago

Appreciate the pointer on the arguments. Funny enough, I had already solved the issue on a previous version of the script and haven't implemented that on the new one yet. Talking about which, the interactive shell is required for alias support.