‘bash -c’ 起什么作用?
- 2024-10-29 08:35:00
- admin 原创
- 182
问题描述:
我遵循了以下教程:http://davidtsadler.com/archives/2012/06/03/how-to-install-magento-on-ubuntu/
有时它告诉我执行以下命令:
sudo bash -c "cat >> /etc/apache2/sites-available/magento-store.com <<EOF
<VirtualHost *:80>
ServerName localhost.magento-store.com
ServerAlias www.localhost.magento-store.com
DocumentRoot /home/dev/public_html/magento-store.com/public
LogLevel warn
ErrorLog /home/dev/public_html/magento-store.com/log/error.log
CustomLog /home/dev/public_html/magento-store.com/log/access.log combined
</VirtualHost>
EOF"
这个命令起了什么作用?我如何取消它?
我重启了电脑,发现它还在运行。我查看了.bashrc
和.profile
,但是没有在里面找到它。
解决方案 1:
引自man bash
:
-c 字符串 如果存在 -c 选项,则命令将从字符串中读取。
如果字符串后面有参数,则它们将分配给位置参数,从 $0 开始。
您引用的命令会将heredoc 中的文本(即标签中的文本)附加VirtualHost
到文件/etc/apache2/sites-available/magento-store.com
。
解决方案 2:
Bash 的手册页(例如man bash
)说该-c
选项执行字符串中的命令;即引号内的所有内容。
解决方案 3:
查看你的机器上或者互联网上的手册页,比如这个。
引用:
-c string
If the -c option is present, then commands are read from string.
If there are arguments after the string, they are assigned to the positional
parameters, starting with $0.
相关推荐
热门文章
项目管理软件有哪些?
热门标签
云禅道AD