Etc/Etc

[MAC] shell 파일 생성하기

미피뿌 2023. 2. 17. 16:31
반응형

[MAC] shell 파일 생성하기 

 

 

파일 생성

$ touch shellname.sh

 

파일 편집

$ vi shellname.sh

 

i를 눌러 insert 모드에 진입한 후 shell 내용 작성

$!/bin/sh
echo "Hello"

 

esc키를 누르고 :wq입력하여 insert 모드를 빠져나온다.

 

터미널에서 실행가능한 파일로 변경

$ chmod 755 shellname.sh

 

터미널에서 실행

$ ./shellname.sh
반응형