[linux] 스크립트에서 ls 등 명령어 실행하는 법


쉘이라는 개념이 어려우신 분은 아래의 링크를 참조하세요.
쉘 스크립트란? https://daewoonginfo.blogspot.com/2019/04/linux.html

쉘 스크립트에서 명령어 실행하는 법

쉘 스크립트 생성

$ vi run_init.sh

#!/bin/bash
ls
현재 디렉토리에 있는 내용을 출력하게 만들었습니다.


실행 권한 부여

$ chmod +x run_init
run_init.sh을 실행시키기 위해 실행권한(execute)을 부여했습니다.

chmod가 익숙하지 않으신 분은 아래의 링크를 참조하세요.
chmod - https://daewoonginfo.blogspot.com/2019/06/linux-chmod.html

쉘 스크립트 실행

$ ./run_init.sh





댓글

이 블로그의 인기 게시물

[opencv-python] 이미지 크기조절(resize) 하는 법

[python] selenium close와 quit 차이점

[python]파이썬: csv reader header skip (첫번째 행 무시하기, 안읽기)