Skip to main content

[Unix/Linux] C – 하위 디렉토리 출력하는 프로그램

#include <unistd.h> #include <sys/types.h> #include <dirent.h> #include <stdio.h> #include <sys/stat.h>   // 인수로 전달 받은 디렉토리의 하위 디렉토리를 출력하는 함수. void subdirOutput(char *wd);   // 디렉토리 들여쓰기를 위한 디렉토리 경로 레벨 저장용. int indent = 0;   int main() { printf(”Sub-Directory Ouput!!!\n”); printf(”———————-\n”);   // 현재 디렉토리의 하위 디렉토리를 출력시킨다. subdirOutput(”.”);   return 0; } […]

Read More

Bourne 셸 – 다음 조건을 만족하는 셸 스크립트를 작성하라.(2)

문5]. 사용자로부터 숫자를 입력받아서 이를 출력하는 셸 스크립트를 작성하라. 답5]. total=expr $1 + $2 + $3 + $4 + $5 echo ”total = $total” 문6]. Here 자료를 이용하여 문장내 ”kug” 문자열을 검색하는 셸 스크립트를 작성하라. 답6]. grep -i ”kug” << ++ kug       0.1       30       korea kang […]

Read More

Bourne 셸 – 다음 조건을 만족하는 셸 스크립트를 작성하라.(1)

문1]. ”test” 명령을 사용하여 현재 로그인한 사용자가 몇 명인지를 계산하는 셸 프로그램을 작성하라. 답1]. userID=”root” count=0 for n in users do if [ $userID != $n ] then userID=$n count=expr $count + 1 fi done echo ”현재 로그인한 사용자 수 : $count” 문2]. 반복문(while, for, until)을 사용하여 구구단을 표시하는 셸을 작성하라. (그냥 제가 보기 좋게 […]

Read More