bash4 셸 스크립트를 바이너리 실행파일로 만들기 Rocky Linux에서 shc(Shell Script Compiler)를 설치하는 방법을 정리한다. shc는 쉘 스크립트를 컴파일하여 바이너리 실행파일로 변환하는 도구로 사용된다. 참고 사이트- https://linux.die.net/man/1/shc- https://github.com/neurobin/shc- https://rhel.pkgs.org/8/epel-x86_64/shc-4.0.3-1.el8.x86_64.rpm.html- https://neurobin.org/projects/softwares/unix/shc/ 1. 필수 패키지 설치먼저, shc를 빌드하기 위해 필요한 패키지를 설치한다.sudo dnf install -y gcc make 2. shc 다운로드 및 빌드shc 소스 코드 다운로드c.. 2024. 8. 7. Bash Programming-2.Redirection https://www.gnu.org/software/bash/manual/html_node/Redirections.html Redirections (Bash Reference Manual)3.6 Redirections Before a command is executed, its input and output may be redirected using a special notation interpreted by the shell. Redirection allows commands’ file handles to be duplicated, opened, closed, made to refer to different files, and canwww.gnu.orghttps://tldp.org/HOWTO/Bash-.. 2024. 7. 22. Bash Programming-1.HelloWorld 배시(Bash) 스크립트로 "Hello World!" 출력하기 1. vi 편집기로 파일 생성하여 열기vi helloworld.sh 2. 스크립트 입력다음 내용 입력 후 ESC, :wq 를 입력하여 저장하고 vi 종료#!/bin/bashecho Hello World!- "#!": 는 shebang이라고 불리는 것으로 이 파일을 실행할 인터프리터를 지정한다. 이 예제에서는 배시를 사용하며 경로는 /bin/bash로 되어있다.Shebang이 없을 경우도 동일한 결과가 나오지만, 그건 현재 접속해 있는 셸(아마 Bash)에서 echo를 직접 실행하게 되기 때문이다.- "echo": echo 이후에 나오는 문장을 그대로 출력한다. 메아리(echo)라는 명령어 의미를 생각하면 쉽게 이해할 수 있다. 3. 파일 실.. 2024. 7. 13. 배쉬 셸(Bash Shell) 초기화 파일배쉬 셸(Bash shell)은 여러 가지 초기화 파일을 현재 셸에 적용하도록 제공할 수 있다. 초기화 파일은 로그인 셸, 대화형 셸, 비대화형 셸에 따라 선택된다. 사용자의 로그인 시 계정 홈 경로의 .bash_profile 파일이 제공되며 .bash_profile이 없고 .bash_login이 있으면 이 파일이 대신 제공된다. bash_login도 없으면 .profile이 제공된다. 로그인 셸에서의 초기화 파일 호출 순서1. /etc/profile2. /etc/profile.d/*.sh3. ~/.bash_profile or ~/.bash_login or ~/.profile4. /etc/bashrc /etc/profile 이란: 로그인 설정을 위한 시스템 전역 환경변수와 시작 프로그램에 대.. 2024. 7. 11. 이전 1 다음