2007-04-22 22:18:06 +00:00
|
|
|
|
2007-09-22 19:30:55 +00:00
|
|
|
function eval -S -d "Evaluate parameters as a command"
|
2007-10-06 10:23:26 +00:00
|
|
|
|
|
|
|
# If we are in an interactive shell, eval should enable full
|
|
|
|
# job control since it should behave like the real code was
|
|
|
|
# executed. If we don't do this, commands that expect to be
|
|
|
|
# used interactively, like less, wont work using eval.
|
|
|
|
|
|
|
|
set -l mode
|
|
|
|
if status --is-interactive-job-control
|
|
|
|
set mode interactive
|
|
|
|
else
|
|
|
|
if status --is-full-job-control
|
|
|
|
set mode full
|
|
|
|
else
|
|
|
|
set mode none
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if status --is-interactive
|
|
|
|
status --job-control full
|
|
|
|
end
|
|
|
|
|
2013-01-20 09:59:25 +00:00
|
|
|
echo "begin; $argv ;end eval2_inner <&3 3<&-" | . 3<&0
|
2010-11-22 11:36:42 +00:00
|
|
|
set -l res $status
|
2007-10-06 10:23:26 +00:00
|
|
|
|
|
|
|
status --job-control $mode
|
2010-11-22 11:36:42 +00:00
|
|
|
return $res
|
2007-04-22 22:18:06 +00:00
|
|
|
end
|