Develop
2003.04.23 10:24
[linux] 쉘 스크립트를 이용한 BBS
Views 10083 Comment 0
[ Shell을 이용한 BBS ]
--------------------------------------------------------
WELCOME TO MY BBS
--------------------------------------------------------
1. List the files on the BBS.
2. Read a file.
3. Mail to manager.
4. Talk to friend.
5. Exit.
--------------------------------------------------------
Put the number:
메인 메뉴에서 사용자가 "1"을 입력하면, 다음과 같은 화면이 나온다.
-------------------------------------------------------
Files to Read
-------------------------------------------------------
1 4 6.hwp cobol
2 6 7 cover
3 6.bak 999.hwp cover
-------------------------------------------------------
메인 메뉴에서 사용자가 "2"를 입력하면, 다음과 같은 화면이 나온다.
-------------------------------------------------------
Put the file name to read:
-------------------------------------------------------
사용자가 파일 이름을 입력하면, BBS는 화일의 내용을 화면에 출력한다.
메인 메뉴에서 "3"을 입력하면, root에게 메일을 보낼수 있도록 한다.
mail root
메인 메뉴에서 "4"를 입력하면, 다음과 같이 시스템에 로그인한
사람들을 화면에 보여준다.
-------------------------------------------------------
Users who login this system are..
-------------------------------------------------------
Login Name TTY Idle When Where
mhyun Yun myungwha p0 35 Fri 19:45 Enigma
kjkim Kwan-joong Kim p1 5:26 Tue 17:28 brahms
jmchoi Choi Jong Myung *p2 Fri 17:11 hannah
jmchoi Choi Jong Myung p3 Fri 21:46 hannah
-------------------------------------------------------
Put the login name to talk:
토크하고 싶은 사람의 로그인 이름을 입력하면, 토크를 한다.
메인 메뉴에서 "5"를 입력하면, BBS에서 빠져나간다.
--------------------------------------------------------------------------------
Shell을 이용해 작성한 BBS는 다음과 같다.
#!/bin/csh
#
onintr begin
while(1)
begin:
echo -------------------------------------------------------------------------
echo " VERY SIMPLE BBS(VSBBS)"
echo -------------------------------------------------------------------------
echo " 1.list all files"
echo " 2.read a file"
echo " 3.mail"
echo " 4.talk to friend"
echo " 5.exit"
echo "-------------------------------------------------------------------------"
echo " Put the number you want:c"
set num = $<
if("$num" == 1)then
echo ---------------------------------------------------------------------------
echo " File list "
echo ===========================================================================
ls
else if("$num" == 2)then
echo " Put the file name you want to read:c "
set file = $<
more $file
else if("$num" == 3)then
echo "----------------------------------------------------"
echo "to mail admin, press a. to mail friend,press f"
echo "----------------------------------------------------"
set select = $<
switch($select)
case [aA]:
mail root
breaksw
case [fF]:
echo "Input the name :c "
set friend = $<
mail $friend
breaksw
endsw
else if("$num" == 4)then
echo "---------------------------------------------------"
echo " Users on the system "
echo "---------------------------------------------------"
finger
echo "---------------------------------------------------"
echo "Input the name of person :c "
set person = $<
talk $person
else if("$num" == 5)then
echo good_bye
exit 0
endif
end
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
1113 | System/OS | How to Setup an Email Server on CentOS 7 | hooni | 2018.04.05 | 3041 |
1112 | Develop | How to Test SMTP AUTH using Telnet | hooni | 2018.04.05 | 1595 |
1111 | Develop | [python] DJI Tello 드론 코딩 (프로그래밍) 58 | hooni | 2018.03.04 | 28807 |
1110 | System/OS | [mac] 맥에서 기본 실행 앱 변경하기 | hooni | 2018.03.02 | 1976 |
1109 | System/OS | 콘솔에서 패스워드 걸린 zip 압축하는 명령 | hooni | 2018.03.02 | 1142 |
1108 | Develop | What is difference between Get, Post, Put and Delete? | hooni | 2018.02.28 | 1577 |
1107 | Develop | [php] Laravel Route에서 PC/Mobile 분기 | hooni | 2018.01.24 | 2688 |
1106 | Develop | Laravel 5 Failed opening required bootstrap/../vendor/autoload.php | hooni | 2018.01.24 | 1843 |
1105 | Develop | [php][laravel] 라라벨 개발환경 세팅하기 (Mac, Window) 2 | hooni | 2017.12.15 | 2789 |
1104 | Develop | [php][laravel] 라라벨 프로젝트 생성 및 구조 | hooni | 2017.12.15 | 2561 |
1103 | Develop | [php][laravel] 초간단 MacOS에서 Laravel 개발 환경 구축 | hooni | 2017.12.15 | 2130 |
1102 | Database | [mysql] MacOS에 MySQL 설치, 설정, 암호 재설정 | hooni | 2017.12.15 | 1631 |