# [Bash] 스크립트 #! 의미

 

#!는 스크립트 제일 앞에서

어떤 명령어 해석기를 이용하여 파일을 실행할 것인지를 명시하는 것이다.

 

리눅스에서는 기본적으로 파일을 실행할때 bash 쉘로 설정되어 있어서

따로 명시를 하지 않아도

#!/bin/bash
#!/bin/sh

위의 bash 쉘로 자동 실행되게 한다.

 

다음의 예시를 통해 눈으로 확인해보자.

[root@chuchu test]# cat test1.sh 
#!/bin/bash

echo "Hello World!"
[root@chuchu test]# cat test2.sh 
#!/bin/cat

echo "Hello World!"
[root@chuchu test]# 
[root@chuchu test]# ./test1.sh 
Hello World!
[root@chuchu test]# ./test2.sh 
#!/bin/cat

echo "Hello World!"

 

참고: https://hahoital.tistory.com/145

To be continued.........

 

 

Made by 꿩

'IT > Bash' 카테고리의 다른 글

[Python] Database connection  (0) 2022.05.09
[Linux] SSH 공개키 설정  (0) 2022.03.28
[Bash] 터미널 jar 파일 생성  (0) 2021.10.05
[centos] java openjdk 설치 및 삭제  (0) 2021.10.05
Redis 메모리 & 시간 측정 스크립트  (0) 2021.05.14

+ Recent posts