/usr/share/doc/HOWTO/ja-html/Bash-Prog-Intro-HOWTO-8.html is in doc-linux-ja-html 2006.05.25-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>BASH Programming - Introduction HOW-TO: ´Ø¿ô(functions)</TITLE>
<LINK HREF="Bash-Prog-Intro-HOWTO-9.html" REL=next>
<LINK HREF="Bash-Prog-Intro-HOWTO-7.html" REL=previous>
<LINK HREF="Bash-Prog-Intro-HOWTO.html#toc8" REL=contents>
</HEAD>
<BODY>
<A HREF="Bash-Prog-Intro-HOWTO-9.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO-7.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO.html#toc8">Ìܼ¡¤Ø</A>
<HR>
<H2><A NAME="s8">8. ´Ø¿ô(functions)</A></H2>
<P>¤Û¤È¤ó¤É¤É¤ó¤Ê¥×¥í¥°¥é¥à¤ËÅö¤Æ¤Ï¤Þ¤ë¤³¤È¤Ç¤¹¤¬¡¢´Ø¿ô(function)¤ò»È¤¨¤Ð¡¢¤è¤ê
ÏÀÍýŪ¤Ë°ì·²¤Î¥³¡¼¥É¤ò¥°¥ë¡¼¥×²½¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¤Þ¤¿¡¢¿ÀÈëŪ¤È¤â¤¤¤¨¤ë
ºÆµ¢Ë¡(recursion)¤ò»È¤¦¤³¤È¤â²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
<P>
<P>´Ø¿ô¤ÎÀë¸À¤Ï¡¢ "<CODE>function my_func { my_code }</CODE>" ¤È
½ñ¤¯¤À¤±¤Ç¤Ç¤¤Þ¤¹¡£
<P>
<P>´Ø¿ô¤Î¸Æ¤Ó½Ð¤·¤Ï¡¢Â¾¤Î¥×¥í¥°¥é¥à¤Î¸Æ¤Ó½Ð¤·¤ÈƱ¤¸¤Ç¡¢¤½¤Î´Ø¿ô̾¤ò½ñ¤¯¤À¤±
¤Ç¤¹¡£
<P>
<P>
<H2><A NAME="ss8.1">8.1 ´Ø¿ô¤Î¥µ¥ó¥×¥ë</A>
</H2>
<P>
<BLOCKQUOTE><CODE>
<PRE>
#!/bin/bash
function quit {
exit
}
function hello {
echo Hello!
}
hello
quit
echo foo
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>Æó¹ÔÌܤ«¤é»Í¹ÔÌܤˤ«¤±¤Æ¤Ï¡¢"<CODE>quit</CODE>" ¤È¤¤¤¦´Ø¿ô¤¬µ½Ò
¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¸Þ¹ÔÌܤ«¤é¼·¹ÔÌܤˤ«¤±¤Æ¤Ï¡¢"<CODE>hello</CODE>" ¤È¤¤¤¦
´Ø¿ô¤¬µ½Ò¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¤³¤Î¥¹¥¯¥ê¥×¥È¤¬²¿¤ò¤·¤Æ¤¤¤ë¤«´°Á´¤ËÇÄ°®¤Ç¤¤Ê¤¤¤Ê
¤é¡¢¼ÂºÝ¤Ë¼«Ê¬¤Ç½ñ¤¤¤Æ¡¢¼Â¹Ô¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
<P>
<P>´Ø¿ô¤Ï¡¢²¿¤é¤«¤ÎÆÃÄê¤ÎÍͼ°¤Ë¤è¤ëÀë¸À¤òɬÍפȤ·¤Ê¤¤¤È¤¤¤¦¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À
¤µ¤¤¡£
<P>
<P>¤³¤Î¥¹¥¯¥ê¥×¥È¤ò¼Â¹Ô¤¹¤ë¤È¡¢ºÇ½é¤Ë "<CODE>hello</CODE>" ´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¡¢¼¡¤Ë
"<CODE>quit</CODE>" ´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹¡£¤½¤·¤Æ¥×¥í¥°¥é¥à¤Ï½½¹ÔÌܤޤǤϼ¹Ԥµ¤ì
¤Ê¤¤¤³¤È¤Ëµ¤ÉÕ¤¯¤Ç¤·¤ç¤¦¡£
<P>
<H2><A NAME="ss8.2">8.2 ¥Ñ¥é¥á¡¼¥¿¡¼¤ò¼è¤ë´Ø¿ô¤Î¥µ¥ó¥×¥ë</A>
</H2>
<P>
<BLOCKQUOTE><CODE>
<PRE>
#!/bin/bash
function quit {
exit
}
function e {
echo $1
}
e Hello
e World
quit
echo foo
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>¾åµ¤Î¥×¥í¥°¥é¥à¤Ï¡¢Á°µ¤Î¥×¥í¥°¥é¥à¤È¤Û¤ÜƱ°ì¤Ç¤¹¡£¼ç¤Ê°ã¤¤¤Ï¡¢
´Ø¿ô "<CODE>e</CODE>" ¤Î¸ºß¤Ç¤¹¡£¤³¤Î´Ø¿ô¤Ï¼õ¤±¼è¤Ã¤¿Âè°ì°ú¿ô¤òɽ¼¨¤·¤Þ¤¹¡£
°ú¿ô¤Ï¡¢´Ø¿ô¤ÎÆâÉô¤Ë¤¢¤ë¤È¤¤Ç¤â¡¢¥¹¥¯¥ê¥×¥È¤ËľÀÜÅϤ·¤¿¤È¤¤ÈƱ¤¸¤è¤¦¤Ë°·¤ï
¤ì¤Þ¤¹¡£
<P>
<P>
<P>
<HR>
<A HREF="Bash-Prog-Intro-HOWTO-9.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO-7.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO.html#toc8">Ìܼ¡¤Ø</A>
</BODY>
</HTML>
|