Re: [dev] [dmenu] dmenu_run improvements

From: lolilolicon <lolilolicon_AT_gmail.com>
Date: Sun, 24 Jul 2011 20:13:46 +0800

On Sun, Jul 24, 2011 at 6:41 PM, lolilolicon <lolilolicon_AT_gmail.com> wrote:
> cmd=`dmenu "$@" < "$CACHE"` && eval exec "$cmd"
>
> NOTE:
> The (subshell) is used so the declarations won't get inherented, but
> the user still has access to the $CACHE and $cmd environments.
>

Hmm, maybe instead of `eval exec', we could just use `exec sh -c' instead?

  cmd=`dmenu "$@" < "$CACHE"` || exit $?
  exec sh -c "$cmd"

The benefits are:

1. Only exported environment variables will be available to the user command.
2. The user can run any shell command, including, e.g.,

  if true; then echo hello\ world; fi

Correct me if I'm missing something here. Thanks.
Received on Sun Jul 24 2011 - 14:13:46 CEST

This archive was generated by hypermail 2.2.0 : Sun Jul 24 2011 - 14:24:02 CEST