This file is indexed.

/usr/share/doc/HOWTO/ja-html/Bash-Prog-Intro-HOWTO-5.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
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
<!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: ÊÑ¿ô (variable)</TITLE>
 <LINK HREF="Bash-Prog-Intro-HOWTO-6.html" REL=next>
 <LINK HREF="Bash-Prog-Intro-HOWTO-4.html" REL=previous>
 <LINK HREF="Bash-Prog-Intro-HOWTO.html#toc5" REL=contents>
</HEAD>
<BODY>
<A HREF="Bash-Prog-Intro-HOWTO-6.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO-4.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO.html#toc5">Ìܼ¡¤Ø</A>
<HR>
<H2><A NAME="s5">5. ÊÑ¿ô (variable)</A></H2>

<P>ÊÑ¿ô¤ò»È¤¨¤Ê¤¤¥×¥í¥°¥é¥à¸À¸ì¤Ï¤¢¤ê¤Þ¤»¤ó¡£¤¿¤À¡¢<CODE>bash</CODE> ¤Ë¤Ï¥Ç¡¼¥¿
·¿(data type)¤¬¤¢¤ê¤Þ¤»¤ó¡£<CODE>bash</CODE> ¤ÎÊÑ¿ô¤Ï¡¢¿ô»ú¡¢Ê¸»ú¡¢Ê¸»úÎó¤ò³ÊǼ
¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
<P>ÊÑ¿ô¤òÀë¸À¤¹¤ëɬÍפϤʤ¯¡¢»²¾È¤¹¤Ù¤­ÊÑ¿ô¤ËÃͤòÂåÆþ¤¹¤ì¤Ð¡¢¤½¤ì¤À¤±¤Ç
ºîÀ®¤Ç¤­¤Þ¤¹¡£
<P>
<P>
<H2><A NAME="ss5.1">5.1 ¥µ¥ó¥×¥ë: ÊÑ¿ô¤ò»È¤Ã¤¿ Hello World!</A>
</H2>

<P>
<BLOCKQUOTE><CODE>
<PRE>
        #!/bin/bash
        STR="Hello World!"
        echo $STR
        
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>2 ¹ÔÌÜ¤Ç <CODE>STR</CODE> ¤È¤¤¤¦ÊÑ¿ô¤òºî¤Ã¤Æ¡¢¤½¤ì¤Ë <CODE>"Hello World"</CODE> ¤È¤¤
¤¦Ê¸»úÎó¤òÂåÆþ¤·¤Æ¤¤¤Þ¤¹¡£¤³¤ÎÊÑ¿ô¤Î¡ÖÃ͡פÏÊÑ¿ô¤ÎºÇ½é¤Ë "<CODE>$</CODE>" ¤òÃÖ¤¯
¤³¤È¤Ç¼è¤ê½Ð¤»¤Þ¤¹¡£
¤â¤· "<CODE>$</CODE>" ¤È¤¤¤¦µ­¹æ¤ò»È¤ï¤Ê¤«¤Ã¤¿¤é¥×¥í¥°¥é¥à¤Î½ÐÎϤϰ㤦¤â¤Î¤È¤Ê
¤ê¡¢Ë¾¤ó¤À·ë²Ì¤òÆÀ¤é¤ì¤Ê¤¤¤È¤¤¤¦¤³¤È¤òÍý²ò¤·¤Æ(¤¢¤ë¤¤¤Ï¼ÂºÝ¤Ë¤ä¤Ã¤Æ¤ß¤Æ)¤¯¤À
¤µ¤¤¡£
<P>
<P>
<H2><A NAME="ss5.2">5.2 ¥µ¥ó¥×¥ë: Èó¾ï¤Ë¥·¥ó¥×¥ë¤Ê¥Ð¥Ã¥¯¥¢¥Ã¥×¥¹¥¯¥ê¥×¥È(²þÎÉÈÇ)</A>
 </H2>

<P> 
<BLOCKQUOTE><CODE>
<PRE>
        #!/bin/bash          
        OF=/var/my-backup-$(date +%Y%m%d).tgz
        tar -cZf $OF /home/me/
        
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>¾åµ­¤Î¥¹¥¯¥ê¥×¥È¤Ï¡¢º£¤Þ¤Ç¤È¤Ï¾¯¤·°ã¤¦¤³¤È¤ò¾Ò²ð¤·¤Æ¤¤¤Þ¤¹¡£¤Þ¤ºÆó¹ÔÌܤˤ¢¤ë
ÊÑ¿ô¤ÎºîÀ®¤ÈÂåÆþ¤Ë¤Ä¤¤¤Æ¤Ï¤â¤¦´·¤ì¤¿¤È»×¤¤¤Þ¤¹¡£
¤Ç¤Ï¡¢"<CODE>$(date +%Y%m%d)</CODE>" ¤È¤¤¤¦É½¸½¤ËÃíÌܤ·¤Æ¤¯¤À¤µ¤¤¡£
¥¹¥¯¥ê¥×¥È¤ò¼Â¹Ô¤¹¤ë¤È¡¢´Ý¥«¥Ã¥³¤Î¤Ê¤«¤Î¥³¥Þ¥ó¥É¤¬¼Â¹Ô¤µ¤ì¤Æ¡¢¤½¤Î½ÐÎϤ¬
¼è¤ê¹þ¤Þ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
<P>
<P>¤³¤Î¥¹¥¯¥ê¥×¥È¤Ç¤Ï¡¢<CODE>date</CODE> ¥³¥Þ¥ó¥É¤Î(+%Y%m%d)¤È¤¤¤¦½ñ¼°¥¹¥¤¥Ã¥Á¤Ë½¾¤Ã
¤Æ¡¢½ÐÎϤµ¤ì¤ë¥Õ¥¡¥¤¥ë̾¤¬ËèÆüÊѤï¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£°ã¤Ã¤¿½ñ¼°¤ò»ØÄê
¤¹¤ë¤³¤È¤Ç¡¢¤³¤ì¤È¤Ï°Û¤Ê¤ë¥Õ¥¡¥¤¥ë̾¤Ë¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£
<P>¤½¤ì°Ê³°¤Î»²¹Í»öÎã¤È¤·¤Æ¡¢
<UL>
<LI><CODE>echo ls</CODE></LI>
<LI><CODE>echo $(ls)</CODE></LI>
</UL>

¤È¤¤¤Ã¤¿¤â¤Î¤¬¤¢¤ê¤Þ¤¹¡£
<P>
<P>
<H2><A NAME="ss5.3">5.3 ¥í¡¼¥«¥ëÊÑ¿ô</A>
</H2>

<P>¥í¡¼¥«¥ëÊÑ¿ô¤Ï¡¢<CODE>local</CODE> ¤È¤¤¤¦¥­¡¼¥ï¡¼¥É¤ò»È¤Ã¤ÆºîÀ®¤¹¤ë¤³¤È¤¬¤Ç¤­
¤Þ¤¹¡£
<BLOCKQUOTE><CODE>
<PRE>
        #!/bin/bash
        HELLO=Hello 
        function hello {
                local HELLO=World
                echo $HELLO
        }
        echo $HELLO
        hello
        echo $HELLO
        
</PRE>
</CODE></BLOCKQUOTE>
<P>¥í¡¼¥«¥ëÊÑ¿ô¤Î»È¤¤Êý¤Ë¤Ä¤¤¤Æ¤Ï¡¢°Ê¾å¤ÎÎã¤Ç½¼Ê¬¤«¤È»×¤¤¤Þ¤¹¡£
<P>
<P>
<P>
<P>
<P>
<P>
<HR>
<A HREF="Bash-Prog-Intro-HOWTO-6.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO-4.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO.html#toc5">Ìܼ¡¤Ø</A>
</BODY>
</HTML>