• 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    미해결

shell 을 사용할 때 질문 있습니다.

19.11.30 15:58 작성 조회수 152

0

기본적인 명령어는 잘 되는데요 ls, pwd

따로 미리 설치한 node 나 pm2 등 이런 명령어들은 /bin/sh:

command not found 로 뜨는데 이유를 알 수 있을까요?

답변 3

·

답변을 작성해보세요.

0

아 그러면 두가지 방법으로 가능할 것 같은데요. 

소스코드를 고치거나, 직접 /usr/local/bin을 호출하거나요. 

테스트가 필요할꺼 같긴 한데..bashrc에 source를 추가하는 것도 가능할수도 있겠네요. 

이 중에 원하시는 해결책이 있을까요?

0

김태형님의 프로필

김태형

질문자

2019.11.30

아 /bin/sh 에 있는것만 가능하군요. /usr/local/bin/

에 등록된 외부 cli 명령어도 되는 줄 알았습니다.

shell 을 사용하고 있었습니다.

0

아...어떤 것을 수행했을때는 주시면 좀더 정확하게 답변 드릴수 있을 것 같긴 한데..

command 대신에 shell로 해보시면 어떨까요?

/bin/sh에 있는 것을 읽어들여서 실행하는 건 shell을 통해서 가능해서요.

좀더 궁금하시면 아래의 내용을 읽어보셔도 가능합니다 :) 

만약에 shell로 잘 안되면, 실행했던 내용을 주시면 다시 봐드릴께요!!

====== 출처: https://blog.confirm.ch/ansible-modules-shell-vs-command/  ====

Shell vs. Command

A typical example are the Ansible modules Shell and Command. In the most use cases both modules lead to the same goal. Here are the main differences between these modules.

  • With the Command module the command will be executed without being proceeded through a shell. As a consequence some variables like $HOME are not available. And also stream operations like  <>| and & will not work.
  • The Shell module runs a command through a shell, by default /bin/sh. This can be changed with the option executable. Piping and redirection are here therefor available.
  • The command module is more secure, because it will not be affected by the user’s environment.