쉘 스크립트로 인디언식 이름짓기 해봤어요 ;)

음… 최근 쉘을 공부해보고 있는데…
최근 유행했던 인디언식 이름짓기를 쉘 스크립트로 짜봤네요 ;)
대학 다닐 때 요런 소소한 재미들을 알았다면 어땠을까 하네요.
비록 조악한 실력으로 단순한 내용이지만,
하는동안에는 즐거웠네요 :)

[code:314w5msg]#!/bin/bash

Fundamentals of the UNIX system

this is the project for the seminar

Script Name: indianName.sh

Written by: kibeom yoo

email me: kib.yoo@gmail.com

echo ""
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@@@@@@ 요즘 유행하는 인디언식 이름짓기 놀이 @@@@@@"
echo "@@@@@@ 최근 인터넷을 통해 번져나가는 요놀이 @@@@@@"
echo "@@@@@@ 진짜인지 가짜인지 알 수 없는 잼난놀이 @@@@@@"
echo "@@@@@@ 우리 모두 해봐요 요잼난놀이 함께해요 @@@@@@"
echo "@@@@@@ 혼자하지 않고 옆사람과 함께하는 놀이 @@@@@@"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"

Declare the array for the first name

middle and last name will be used by branch such as if and case

declare -a firstName=(시끄러운 푸른 적색 조용한 웅크린 백색 지혜로운 용감한 날카로운 욕심많은)

input the user’s birthday information

echo ""
echo "자신의 생년월일을 입력하세요."
echo -e "YYMMDD(ex.860128)> \c"
read birth

read the information to variable $birth

to use the matching the namming rule,

$birth would be extracted

to 1 digit for first name

next 2 digits for the middle name

last 2 digits for the last name

yyBirth=${birth:1:1}
mmBirth=${birth:2:2}
ddBirth=${birth:4:2}

echo ""
echo -e " ${birth:0:2}년 $mmBirth월 $ddBirth일에 태어난 \c"
echo -e "당신의 인디언 이름은..바로!!!"
echo -e "\n\n"
echo -e "======>>>>>\t\c"

Using array, print the fisrt name

echo -n ${firstName[$yyBirth]}
echo -e " \c"

Using if, print the middle name

if [ $mmBirth = 01 ]
then
echo -e "늑대\c"
elif [ $mmBirth = 02 ]
then
echo -e "태양\c"
elif [ $mmBirth = 03 ]
then
echo -e "양\c"
elif [ $mmBirth = 04 ]
then
echo -e "매\c"
elif [ $mmBirth = 05 ]
then
echo -e "황소\c"
elif [ $mmBirth = 06 ]
then
echo -e "불꽃\c"
elif [ $mmBirth = 07 ]
then
echo -e "나무\c"
elif [ $mmBirth = 08 ]
then
echo -e "달빛\c"
elif [ $mmBirth = 09 ]
then
echo -e "말\c"
elif [ $mmBirth = 10 ]
then
echo -e "돼지\c"
elif [ $mmBirth = 11 ]
then
echo -e "하늘\c"
elif [ $mmBirth = 12 ]
then
echo -e "바람\c"
fi

Using case, print the last name

case "$ddBirth" in
01) echo -e "와(과) 함께 춤을\c" ;;
02) echo -e "의 기상"\c ;;
03) echo -e "은(는) 그림자속에"\c ;;
04) echo -e "\c" ;;
05) echo -e "\c" ;;
06) echo -e "\c" ;;
07) echo -e "의 환생\c" ;;
08) echo -e "의 죽음\c" ;;
09) echo -e " 아래에서\c" ;;
10) echo -e "을 보라\c" ;;
11) echo -e "이(가) 노래하다.\c" ;;
12) echo -e "의 그림자\c" ;;
13) echo -e "의 일격\c" ;;
14) echo -e "에게 쫒기는 남자\c" ;;
15) echo -e "의 행진\c" ;;
16) echo -e "의 왕\c" ;;
17) echo -e "의 유령\c" ;;
18) echo -e "을(를) 죽인자.\c" ;;
19) echo -e "는(은) 맨날 잠잔다.\c" ;;
20) echo -e "처럼.."\c ;;
21) echo -e "의 고향"\c ;;
22) echo -e "의 전사"\c ;;
23) echo -e "은(는) 나의 친구\c" ;;
24) echo -e "의 노래\c" ;;
25) echo -e "의 정령\c" ;;
26) echo -e "의 파수꾼\c" ;;
27) echo -e "의 악마\c" ;;
28) echo -e "와 같은 사나이\c" ;;
29) echo -e "를(을) 쓰러트린 자\c" ;;
30) echo -e "의 혼\c" ;;
31) echo -e "은(는) 말이 없다\c" ;;
esac
echo -e "\t<<<<<<======"
echo -e "\n\n\n"
[/code:314w5msg]

======>>>>> 푸른 돼지의 고향c
<<<<<<======

이라네요 ;;

[quote="juntai81":2jzfg1dl]======>>>>> 푸른 돼지의 고향c
<<<<<<======

이라네요 ;;[/quote:2jzfg1dl]

인디언들이 실제로 이렇게 이름을 짓진 않는데요…
너무 상심마thㅔ요…(ㅋㅋㅋ;;:wink:

참고로 저는…
[b:2jzfg1dl]======>>>>> 지혜로운 늑대와 같은 사나이 <<<<<<======[/b:2jzfg1dl]

;)

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@ 요즘 유행하는 인디언식 이름짓기 놀이 @@@@@@
@@@@@@ 최근 인터넷을 통해 번져나가는 요놀이 @@@@@@
@@@@@@ 진짜인지 가짜인지 알 수 없는 잼난놀이 @@@@@@
@@@@@@ 우리 모두 해봐요 요잼난놀이 함께해요 @@@@@@
@@@@@@ 혼자하지 않고 옆사람과 함께하는 놀이 @@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
test: 21: Syntax error: "(" unexpected

이런식으로 에러가 나네요