#!/bin/bash

email=$1

if [ "$(echo $email | sed -e 's/[a-zA-Z0-9._%+-]\+@[a-zA-Z0-9-]\+\(\.[a-zA-Z]\{2,4\}\)\{1,3\}//g')" != "" ];then
        str="메일주소비정상"
elif [ "$(echo $email | sed -e 's/^ *//g' -e 's/ *$//g' )" == "" ];then
        str="메일주소없음"
else
        str="메일주소정상"
fi

echo $str


sed 참고자료

'OS > linux / unix' 카테고리의 다른 글

upstart - event.d : init replacement  (0) 2011.01.02
LVM 파티션 마운트하기  (0) 2010.11.18
ffmpeg 으로 리눅스 X11 화면을 동영상으로 만들기  (0) 2010.09.27
screen -e 옵션 (escape) 정리  (0) 2010.09.10
unixtime 변환  (0) 2010.08.25
Latest update: 2010. 10. 16. 10:48

소스를 받아서 풀고 
http://w3.impa.br/~diego/software/luasocket/home.html#download

# make
cd src; make all
make[1]: Entering directory `/usr/local/src/luasocket-2.0.2/src'
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o luasocket.o luasocket.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o timeout.o timeout.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o buffer.o buffer.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o io.o io.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o auxiliar.o auxiliar.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o options.o options.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o inet.o inet.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o tcp.o tcp.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o udp.o udp.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o except.o except.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o select.o select.c
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o usocket.o usocket.c
gcc  -O -shared -fpic -o socket.so.2.0.2 luasocket.o timeout.o buffer.o io.o auxiliar.o options.o inet.o tcp.o udp.o except.o select.o usocket.o
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o mime.o mime.c
gcc  -O -shared -fpic -o mime.so.1.0.2 mime.o
make[1]: Leaving directory `/usr/local/src/luasocket-2.0.2/src'


# make install
cd src; make all
make[1]: Entering directory `/usr/local/src/luasocket-2.0.2/src'
make[1]: `all'를 위해 할 일이 없습니다
make[1]: Leaving directory `/usr/local/src/luasocket-2.0.2/src'
cd src; mkdir -p /usr/local/share/lua/5.1
cd src; cp ltn12.lua socket.lua mime.lua /usr/local/share/lua/5.1
cd src; mkdir -p /usr/local/share/lua/5.1/socket
cd src; cp http.lua url.lua tp.lua ftp.lua smtp.lua /usr/local/share/lua/5.1/socket
cd src; mkdir -p /usr/local/lib/lua/5.1/socket
cd src; cp socket.so.2.0.2  /usr/local/lib/lua/5.1/socket/core.so
#cd src; mkdir -p /usr/local/share/lua/5.1/mime
#cd src; cp  /usr/local/share/lua/5.1/mime
cd src; mkdir -p /usr/local/lib/lua/5.1/mime
cd src; cp mime.so.1.0.2 /usr/local/lib/lua/5.1/mime/core.so


# lua
Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
> require('socket')
stdin:1: module 'socket' not found:
        no field package.preload['socket']
        no file './socket.lua'
        no file '/usr/share/lua/5.1/socket.lua'
        no file '/usr/share/lua/5.1/socket/init.lua'
        no file '/usr/lib/lua/5.1/socket.lua'
        no file '/usr/lib/lua/5.1/socket/init.lua'
        no file './socket.so'
        no file '/usr/lib/lua/5.1/socket.so'
        no file '/usr/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: ?
socket 모듈을 찾지 못합니다.

# ln -s /usr/local/share/lua /usr/share/lua
# export LUA_CPATH=/usr/local//lib/lua/5.1/socket/core.so
심볼릭 링크로 연결해 주고,
LUA_CPATH 를 연결

# lua
Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
> require('socket')
>


동작합니다.

2010-12-07 추가 내용
>  require('socket')
error loading module 'socket' from file '/usr/local//lib/lua/5.1/socket/core.so':
        /usr/local//lib/lua/5.1/socket/core.so: undefined symbol: luaopen_socket
stack traceback:
        [C]: ?
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: ?
>
위와 같은 에러가 발생할 경우

소스에서 2개의 파일을 수정해서 해결했습니다.
luasocket.c
수정 전
LUASOCKET_API int luaopen_socket_core(lua_State *L) { 
수정 후
LUASOCKET_API int luaopen_socket(lua_State *L) {

luasocket.h
수정 전
LUASOCKET_API int luaopen_socket_core(lua_State *L);
수정 후
LUASOCKET_API int luaopen_socket(lua_State *L);
* LUA_CPATH 를 이용해서 라이브러리를 잡아주는 것이 좋습니다.

참고1)
LUA_CPATH 환경변수를 셋팅하지 않고 lua 를 실행 후에 package.cpath 를 셋팅할 수도 있습니다.
package.cpath="/usr/local//lib/lua/5.1/socket/core.so"


참고2) 사용환경입니다.
# cat /etc/issue
Fedora release 8 (Werewolf)

# rpm -q lua
lua-5.1.2-1.fc8

# rpm -ql lua
/usr/bin/lua
/usr/bin/luac
/usr/lib/liblua-5.1.so
/usr/share/doc/lua-5.1.2
/usr/share/doc/lua-5.1.2/COPYRIGHT
/usr/share/doc/lua-5.1.2/HISTORY
/usr/share/doc/lua-5.1.2/README
/usr/share/doc/lua-5.1.2/amazon.gif
/usr/share/doc/lua-5.1.2/contents.html
/usr/share/doc/lua-5.1.2/cover.png
/usr/share/doc/lua-5.1.2/logo.gif
/usr/share/doc/lua-5.1.2/lua.css
/usr/share/doc/lua-5.1.2/lua.html
/usr/share/doc/lua-5.1.2/luac.html
/usr/share/doc/lua-5.1.2/manual.css
/usr/share/doc/lua-5.1.2/manual.html
/usr/share/doc/lua-5.1.2/readme.html
/usr/share/man/man1/lua.1.gz
/usr/share/man/man1/luac.1.gz

참고3) buffer_init 함수 이슈.
buffer_init 함수명 때문에 lighttpd 의 mod_magnet 과  함께 사용할 때 문제가 생긴다.

That is obviously not a lighttpd bug. In fact memcache.lua uses luasockets. Luasockets has a buffer_init function that is called when sending data. Unfortunatly lighty also has a buffer_init method which overwrites luasocket's buffer_int method. Therefore the buffer get's not initialized correct and when the process tries to access buf->tm it fails with a null pointer (sigsegv).

In my opinion that is not a lighttpd bug, but in fact is a result of bad naming in luasockets as a library should at least prefix it's exported methods.

buffer_init 함수명을 임의로 변경하여 해결.

'programming' 카테고리의 다른 글

lua library 설치  (0) 2010.12.07
c2ps - C/C++ to Postscript Converter  (0) 2010.12.07
맨날 헷갈리는 Makefile 패턴규칙 꼬릿말규칙  (0) 2010.08.18
printf 에서 % 기호 표시  (0) 2010.08.02
java - jar , javap  (0) 2010.07.16
Latest update: 2010. 10. 7. 10:50

한국통신 kns.kornet.net 168.126.63.1
한국통신 kns2.kornet.net 168.126.63.2
하나포스 qns1.hananet.net 210.220.163.82
하나포스 qns2.hananet.net 219.250.36.130
LG데이콤 ns.dacom.co.kr 164.124.101.2
LG데이콤 ns2.dacom.co.kr 203.248.240.31 => 응답이 없음.
신비로 ns.shinbiro.com 202.30.143.11
신비로 ns2.shinbiro.com 203.240.193.11
드림라인 ns.cjdream.net 210.181.1.24
드림라인 ns2.cjdream.net 210.181.4.25
파워콤 cns2.bora.net 164.124.107.9
파워콤 cns3.bora.net 203.248.252.2
두루넷 nsgr1.thrunet.com 210.117.65.1
두루넷 nsgr2.thrunet.com 210.117.65.2

나머지는 모두 응답이 있음.


'network' 카테고리의 다른 글

D-Link Printer Server  (0) 2010.07.15
쿡 (Qook , KT) 인터넷 공유기 연결 안될 때  (0) 2010.05.05
Latest update: 2010. 9. 29. 23:25