理解bash exec{logout}?
下面的Bash命令做什么理解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
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