C 에서 shell 의 return 값 받아오기 shell을 만든다. #!/bin/sh echo "shell : system call" exit 4 # C program으로 4를 반환한다. C code를 생성한다. #include #include int main(int argc, char* argv) { int rtn = 0; printf("rtn = %d : system call \n", rtn); rtn = system("./a.sh"); // a.sh을 실행한다. printf("result = %d\n " , rtn); // a.sh로 반환된 값을 찍는다. printf("result = %d\n ", WEXITSTATUS(rtn)); // a.sh로 반환된 값을 함수를 통해 실제 정수로 변환한다. return 0; } 더보기 file 리스트를 반환하는 shell script #!/bin/sh for file in * do if grep -q POSIX $file then echo $file fi done exit 0 더보기 파일 권한 UID/ GID default 셋팅 법 파일 생성시 옵션없이 파일 권한 셋팅 하는 방법 /etc/passwd 파일을 수정한다. 일반적으로 adduser 명령어로 user 생성시 그 정보가 /etc/passwd 에 기록됨 /etc/passwd 파일을 cat 이나 tail , vi 명령어로 확인해 보면 named:x:25:25:Named:/var/named:/sbin/nologin mysql:x:501:501::/home/mysql:/bin/bash 유저아이디:x:udi:gid:서비스 명:홈디렉토리:로그인 금지 설정 더보기 이전 1 ··· 17 18 19 20 21 22 23 다음