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

From: Thorsten Glaser <tg_AT_mirbsd.de>
Date: Sun, 28 Apr 2013 13:29:28 +0000 (UTC)

Peter Hofmann dixit:

>I believe you can work around all these issues by simply prefixing the
>command piped to the shell with an "exec":
>
> dmenu_path | dmenu "$_AT_" | sed 's/^/exec /' | ${SHELL:-"/bin/sh"} &

Won't necessarily work if the result is not a simple command, though…

FWIW:

tg_AT_blau:~ $ cat >x1
#!/bin/sh
printf 'echo "Hello\tWorld!" | hexdump -C\n'
tg_AT_blau:~ $ cat >x2
#!/bin/sh
eval exec "$(./x1)"
tg_AT_blau:~ $ chmod +x x?
tg_AT_blau:~ $ ./x2
00000000 48 65 6c 6c 6f 09 57 6f 72 6c 64 21 0a |Hello.World!.|
0000000d

So the tab is kept when you put Ross’ suggestion into double quotes.

bye,
//mirabilos
-- 
[...] if maybe ext3fs wasn't a better pick, or jfs, or maybe reiserfs, oh but
what about xfs, and if only i had waited until reiser4 was ready... in the be-
ginning, there was ffs, and in the middle, there was ffs, and at the end, there
was still ffs, and the sys admins knew it was good. :)  -- Ted Unangst über *fs
Received on Sun Apr 28 2013 - 15:29:28 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 28 2013 - 15:48:04 CEST