'bash -c'是做什么的? [英] What does 'bash -c' do?

查看:1497
本文介绍了'bash -c'是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了以下教程: http ://davidtsadler.com/archives/2012/06/03/how-to-install-magento-on-ubuntu/

在某个时候它告诉我执行以下命令:

At some point it told me to execute the following command:

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"

此命令的作用是什么,我该如何取消呢?

What did this command do, and how I can cancel that?

我重新启动了计算机,看来它仍在运行.我查看了.bashrc.profile,但没有在里面找到它.

I restarted the computer, and it seems that it is still running. I looked in .bashrc and .profile, but I did not find it inside.

推荐答案

man bash引用:

   -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.

您引用的命令会将附加在heredoc中的文本(即VirtualHost标记中的文本)添加到文件/etc/apache2/sites-available/magento-store.com.

The command quoted by you would append the text in heredoc (i.e. the text in VirtualHost tag) to the file /etc/apache2/sites-available/magento-store.com.

这篇关于'bash -c'是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆