[dev] [PATCH v3] dmenu_run: Don't leave a shell running

From: Ross Lagerwall <rosslagerwall_AT_gmail.com>
Date: Sat, 27 Apr 2013 22:15:12 +0100

The previous logic leaves a shell running for the duration that the
launched application runs.
This changes it so that the only application that is left running is
the launched application.
---
OK, so here is another attempt.  It should hopefully behave like the
current master branch (without the shell being left running).
If you type: a\ b "c d" e
then it will try and execute the program "a b" and pass it two arguments,
"c d" and "e".
If the eval is not used (as suggested Truls), then it is not
possible to escape or quote arguments properly.
For example, typing: prog "a b"
results in two arguments being passed to prog rather than one.
Clearly, I'm no expert at shell programming so if there are any experts
that know an easier way...
Thanks for taking a look at this.
Ross
 dmenu_run | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dmenu_run b/dmenu_run
index 834ede5..e8c728d 100755
--- a/dmenu_run
+++ b/dmenu_run
_AT_@ -1,2 +1,2 @@
 #!/bin/sh
-dmenu_path | dmenu "$_AT_" | ${SHELL:-"/bin/sh"} &
+eval exec $(dmenu_path | dmenu "$_AT_")
-- 
1.8.2.1
Received on Sat Apr 27 2013 - 23:15:12 CEST

This archive was generated by hypermail 2.3.0 : Sat Apr 27 2013 - 23:24:05 CEST