我正在查看一些正在为我当前项目工作的老人编写的 shell 脚本。在文件末尾,它简单地包含文件夹/文件路径,例如,
/home/udhay-dev/work/udhay/bin/rm-vhosts
/home/udhay-dev/work/udhay/bin/vhosts
/home/udhay-dev/work/udhay/bin/apache
在文件末尾。当执行这些行时,它会抛出
vhost.sh: line 22: /home/udhay-dev/work/udhay/bin/rm-vhosts: Is a directory
vhost.sh: line 23: /home/udhay-dev/work/udhay/bin/vhosts: Permission denied
vhost.sh: line 24: /home/udhay-dev/work/udhay/bin/apache: Is a directory
但我对这些一无所知,因为我对 Ubuntu 和 Shell 脚本都几乎不熟悉。在 shell 脚本中简单地包含这些行的原因或目的是什么?请帮忙。
答案1
vhost.sh: line 22: /home/udhay-dev/work/udhay/bin/rm-vhosts: Is a directory
rm-vhosts
显示目录内有名为的目录/home/udhay-dev/work/udhay/bin
。
vhost.sh: line 23: /home/udhay-dev/work/udhay/bin/vhosts: Permission denied
vhosts
显示目录内有名为的文件/home/udhay-dev/work/udhay/bin
。
vhost.sh: line 24: /home/udhay-dev/work/udhay/bin/apache: Is a directory
apache
显示目录内有名为的目录/home/udhay-dev/work/udhay/bin
。
vhost.sh
是脚本名称。line xx
表示脚本中抛出上述消息的行号。