Bash 3.2.57
考虑以下脚本:
return next.handle(request).map((event: HttpEvent<any>) => {
if (event instanceof HttpResponse && event.body && !event.body.success) {
throw new HttpErrorResponse({
error: 'your error',
headers: evt.headers,
status: 500,
statusText: 'Warning',
url: evt.url
});
}
return event;
);
如上所述运行#!/bin/bash
command1="ls"
$command1
command2="ls"
$command2 >&2
command3="ls >&2"
$command3
和command1
会产生直观的结果。首先将command2
打印到 stdout ,然后打印到 stderr 。
尽管运行第三条命令会产生ls
。
为什么Bash将ls: >&2: No such file or directory
的重定向解释为重定向,而不是command2
的重定向?
是否有可能在变量中捕获重定向?