Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
理解bash exec{logout}?_Bash - Fatal编程技术网

理解bash exec{logout}?

理解bash exec{logout}?,bash,Bash,下面的Bash命令做什么 exec {logout}> >(tee -a "${LOGFILE}") 或 从Bash参考资料中,关于: 每个重定向之前可能有一个文件描述符编号,但之前可能有一个{varname}形式的单词。在这种情况下,除了&-和 exec {logout}>> "${LOGFILE}" exec {logout}> >(tee -a "${LOGFILE}") tee -a "${LOGFILE}" #!/bin/bash logf

下面的Bash命令做什么

exec {logout}> >(tee -a "${LOGFILE}")


从Bash参考资料中,关于:

每个重定向之前可能有一个文件描述符编号,但之前可能有一个
{varname}
形式的单词。在这种情况下,除了
&-

exec {logout}>> "${LOGFILE}"
exec {logout}> >(tee -a "${LOGFILE}")
tee -a "${LOGFILE}"
#!/bin/bash

logfile=testlogfile

exec {logout}> >(tee -a "$logfile")
echo "logout=$logout"

# now output some stuff to fd $logout:
echo >&"$logout" "Hello file descriptor $logout"

# it will send the message to tee, so that you'll see it on stdout
# and will also be appended to $logfile

# Check that output really got to $logfile:
cat "$logfile"
exec {logout}>&-
ls /dev/fd