programing

bash -c'는 무엇을 합니까?

elseif 2023. 4. 29. 08:47

bash -c'는 무엇을 합니까?

저는 다음 튜토리얼을 따랐습니다: 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하지만 안에서 찾지 못했습니다.

인용 출처man bash:

-c string -c 옵션이 있으면 문자열에서 명령을 읽습니다.
문자열 뒤에 인수가 있으면 $0으로 시작하는 위치 매개 변수에 할당됩니다.

사용자가 인용한 명령은 여기 문서에 텍스트를 추가합니다(즉, 텍스트는VirtualHost파일에 태그)를 추가합니다./etc/apache2/sites-available/magento-store.com.

Bash에 대한 수동 페이지(예:man bash)에 따르면-coption은 문자열에서 명령을 실행합니다. 즉, 따옴표 안에 있는 모든 명령을 실행합니다.

당신의 기계나 인터넷에서 남성 페이지를 확인하세요, 이것과 같은.

인용문:

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

언급URL : https://stackoverflow.com/questions/20858381/what-does-bash-c-do