为什么$ 1*$ 2显示目录中所有内容的文件名?
当我在代码中犯了一个错误时,这是我偶然发现的(忘记$(())
lol),所以我已经解决了我的愚蠢错误,但是为什么$ 1*$ 2 $ 2
为您提供脚本所在目录中的文件和文件夹的列表吗?
以下是一个示例
。
echo $1*$2
$ bash script.sh
random.bmp script.sh some text document.odt test file.txt test folder
脚本
$ echo $1*$2
random.bmp script.sh some text document.odt test file.txt test folder
: 功能上的任何地方都有任何文档吗?我短暂地环顾四周,但没有发现其他人对此感到困惑。
This is something I stumbled on when I made a mistake in my code (forgot $(())
lol), so I've fixed my silly mistake already, but why does $1*$2
give you a list of files and folders in the directory that the script is in?
Here is an example:
script.sh:
echo $1*$2
$ bash script.sh
random.bmp script.sh some text document.odt test file.txt test folder
The same thing happens if the command is just directly issued:
$ echo $1*$2
random.bmp script.sh some text document.odt test file.txt test folder
Does anyone know why it acts like this? Is there any documentation anywhere on the function? I briefly looked around about this but didn't find anyone else confused about it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
- glob -greg的Wiki
官方文档: fileName扩展(bash参考手册)
-- glob - Greg's Wiki
Official documentation: Filename Expansion (Bash Reference Manual)