>> Edit article
이름
제목
패스워드
Perl 스크립트 ?( 완전 초보자용)1. Perl ?Perl (Practical Extraction Report Language) 은 Larry Wall 이 텍스트 파일에서 정보를 추출해서 그 정보를 보고서로 작성을 하는 데 사용하기 위해 작성을 했다. 현재 red6.0의 버전은 다음과 같다. [alex99@chongnux /etc]$ perl -v This is perl, version 5.005_03 built for i386-linux Copyright 1987-1999, Larry Wall Perl may be copied only under the terms of either the Artistic License or theGNU General Public License, which may be found in the Perl 5.0 source kit. Complete documentation for Perl, including FAQ lists, should be found onthis system using `man perl' or `perldoc perl'. If you have access to theInternet, point your browser at http://www.perl.com/, the Perl Home 2. Perl 스크립트기본적인 사용법은 다음과 같다. Usage: perl [switches] [--] [programfile] [arguments] 생략.... -e 'command' one line of script. Several -e's allowed. Omit [programfile]. 생략...*간단한 연습 1[alex99@chongnux /etc]$ perl -e 'print "haha, 쉬이이";'haha, 쉬이이 ☞간단해설 perl -e '펄의 내장함수를 사용할 수 있음' perl은 C언어와 굉장히 유사하다.. print(), {} , ...등등 많은 면에서 비슷하다.2.1. hello, Shee ! ① 먼제 perl 실행화일의 위치를 파악한다. 유심히 봐두길 바란다. 패스가 정확해야 스크립트가 실행이 된다. [alex99@chongnux /etc]$ which perl /usr/bin/perl ② vi hello 혹은 자신이 원하는 이름의 파일을 연다. #!/usr/bin/perl # perl 의 위치를 선언 해준다. print "hello, Shee! "; #c언어와 유사하다는 것을 알 수 있다. ③ 저장을 한 후에 퍼미션을 바꾸어 준다. [root@chongnux test]# chmod +x hello ④ 실행을 해본다. [root@chongnux test]# ./hello hello, Shee ! ☞ ./ hello 해주는 이유는 지금 디렉토리를 참고해서 실행하는 뜻이다. 만약 그냥. hello 한다면 다음과 같이 나올 것이다. 기본적으로 명령을 실행 할 때는 Path 를 참고해서 하기 때문에 여기서는 현 디렉토리를 지칭해주는 ./를 사용해야한다. [root@chongnux test]# hello bash: hello: command not found 위에서 본 것 처럼 한 라인 스크립트를 파일로 저장 실행 퍼미션을 주면 실행이 가능하다. /usr/bin/ 에 그 화일을 첨가 한다면 어느 곳에서나 사용할 수있다. 아니면 자신의 패스에 파일을 카피하면된다.자신의 패스를 확인 [alex99@chongnux /etc]$ echo $PATH/usr/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/alex99/bin[alex99@chongnux /etc]$ 글고 #는 주석인거 아시죠.. :)오늘은 여기까지... 기본을 철저히 이해합시다... 안눙....
Copyleft
1999-2026 by
JSBoard Open Project
Theme Designed by
IDOO
All right reserved