问题描述
在下面的示例中,0>&-
的工作原理是在出现输入提示时ssh-keygen命令存在。
应该不是0<&-
(关闭stdin)吗?
0>&-
和0<&-
似乎都以相同的方式工作(当ssh-keygen的输入/确认提示显示为关闭时)-如何解释?
user@system:~/.ssh$ ls -al test123
ls: cannot access 'test123': No such file or directory
user@system:~/.ssh$ ssh-keygen -b 2048 -t rsa -f test123 -q -N "" 0>&-
user@system:~/.ssh$
user@system:~/.ssh$ ls -al test123
-rw------- 1 user user 1823 Sep 21 08:01 test123
user@system:~/.ssh$ ssh-keygen -b 2048 -t rsa -f test123 -q -N "" 0>&-
test123 already exists.
Overwrite (y/n)? user@system:~/.ssh$
user@system:~/.ssh$
user@system:~/.ssh$ ssh-keygen -b 2048 -t rsa -f test123 -q -N "" 0<&-
test123 already exists.
Overwrite (y/n)? user@system:~/.ssh$
在documentation中有:
n<&-
Close input file descriptor n.
0<&-,<&-
Close stdin.
n>&-
Close output file descriptor n.