Good morning!

Could bash please support x=${<space>cmd;} alongside x=$(cmd)?

x=$(<space>cmd;} works like x=$(cmd), except that cmd does not run in
a subshell, i.e. the stdout within ${<space>cmd;} is redirected to the
variable "x", but any other changes of variables (global/static/local)
are also available outside ${}, unlike $()

<space> can be anything of blank, tab, newline. The cmd must ALWAYS be
terminated with a ";".

Example:
ksh93 -c 'out_stderr="${ { out_stdout="${ ls x ; (( out_res=$? )) ; }"
; } 2>&1 ; }" ; printf "stdout=%q, stderr=%q, exit code=%d\n"
"$out_stdout" "$out_stderr" "$out_res"'
stdout='', stderr=$'ls: cannot access \'x\': No such file or
directory', exit code=2

Ced
-- 
Cedric Blancher <cedric.blanc...@gmail.com>
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur

Reply via email to