글

라벨이 bash인 게시물 표시

Bash 쉘 스크립트 가이드 1.0

kldp 에서 눈팅만 하다가, 좋은 자료가 있어 소개한다. 대부분의 리눅스에서 기본 쉘로 쓰이는 BASH 에 대한 안내서이다. gitbook 과 github 에서 진행되고 있다. 가장 큰 장점은 한글로 작성되어 있어 읽기 편하다는 것이고, BASH 를 체계적으로 설명하고있다는 것이다. 지속적으로 업데이트를 한다고 하니, 수시로 방문해 보는 것도 좋을 듯 하다. gitbook 주소 : https://mug896.gitbooks.io/shell-script/content/   github 주소 : http://mug896.github.io/bash-shell/   * 출처: https://kldp.org/node/154415

Bash 설정 파일들...

여러 셸 중에서 가장 많이 이용되고 있는 셸이라면 단연 Bash 일 것이다. Bash 를 쓰다보면 자주 쓰는 alias 나 환경 변수들을 따로 저장해 둘 필요가 생긴다. 그런데 셸의 실행 형태에 따라 읽어 들이는 설정 파일이 다르다. 이를 모르면 아무리 설정 파일을 바꾸더라도 원하는 결과를 얻지 못하고 좌절할 수 있다. ㅠㅠ 셸 의 실행 형태 셸은 크게 세 가지 형태로 실행된다. 첫째는 interactive login shell 이고, 둘째는 interactive non-login shell, 셋째는 non-interactive shell 이다. 각각 어떤 경우에 해당되는지, 그리고 어떤 설정 파일을 읽어 들이는지 살펴보자. interactive login shell 어떤 시스템에 접속해서 shell 의 prompt 를 보기 위해서는 id 와 password 를 입력하는데, 이렇게 접속했을 때 실행되는 shell 이 interactive login shell 이다. interactive login shell 의 경우, /etc/profile 을 읽은 후 ~/.bash_profile 을 읽고 ~/.bash_login 과 ~/.profile 을 읽는다. interactive non-login shell  어떤 작업을 하다 보면 또 다른 셸을 실행시킬 필요가 있다. 이렇게 실행되는 셸이 interactive non-login shell 이다. 간단히 말해서 시스템에 접속한 후에 새로 실행시키는 셸들을 말한다. 이 interactive non-login shell 은 부모 환경을 그대로 물려받고, ~/.bashrc 를 읽는다. non-interactive shell 터미널에서 가장 많이 하는 작업 중의 하나는 스크립트를 실행 시키는 것이다. 이 때 스크립트를 실행시킬 때 작동하는 셸이 non-interactive shell 이다. 이 non-interactive shell 부모 환경만 물려받고, 별도의 파일을 읽지 않지만,...

Porting to OS/2: Install sh

Available sh on OS/2 are at least three ones. They are pdksh, ash and bash. I recommend to install them all, but to use pdksh mainly. Because it's the fastest among them and supports some interesting features such as extproc of OS/2. However, some unix shell scripts require bash explicitly. And some scripts are happy with ash. So if you have some problem with pdksh, then use ash. But I've not encountered this situation so far. ^^ // ----- 2016/01/04 Use mksh instead of pdksh. mksh is a successor of pdksh, and maintained actively. // ----- 1. pdksh You can get pdksh from http://hobbes.nmsu.edu/download/pub/os2/util/shell/pdksh-5.2.14-bin-4.zip Copy ksh.exe and sh.exe into x:\usr\bin. And copy sh.exe into x:\bin, because unix scripts require /bin/sh. // ----- 2016/01/04 You can get newer versions of pdksh from hobbes. // ----- 2. ash You can get ash from ftp://ftp.netlabs.org/pub/gcc/alpha/ash.zip Copy ash.exe into x:\usr\bin. ash.exe was built wi...