see: https://blog.wentao.me/the-linux-command-line/2014/05/09/bash-expansion.html
bash-3.2$ read
~/.bash_profile
bash-3.2$ echo "$REPLY"
~/.bash_profile
bash-3.2$ ls $REPLY
ls: ~/.bash_profile: No such file or directory
bash-3.2$ ls "$REPLY"
ls: ~/.bash_profile: No such file or directory
如何让这个目录展开?
这里搞错了,REPLY 是一个数组,反正了解意思就行。
echo "${REPLY[0]}"
echo "${REPLY[@]}"
修正第一条append: REPLY不是数组。
https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html#index-read
read [-a aname] [name …]
想要数组的话使用-a
Option
If no names are supplied, the line read is assigned to the variable REPLY.
1
ps1aniuge 2019-09-06 18:39:54 +08:00
powershell on linux:
PS /root> $REPLY='~/.bash_profile' PS /root> ls $REPLY /root/.bash_profile PS /root> ls -l $REPLY -rw-r--r--. 1 root root 176 12 月 29 2013 /root/.bash_profile PS /root> |
2
conanforever22 2019-09-06 18:50:32 +08:00 1
ls `eval echo $REPLY`
|