This file is indexed.

/usr/share/doc/HOWTO/ja-html/Bash-Prog-Intro-HOWTO-10.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!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: ¤½¤Î¾¤Î¥¹¥¯¥ê¥×¥È</TITLE>
 <LINK HREF="Bash-Prog-Intro-HOWTO-11.html" REL=next>
 <LINK HREF="Bash-Prog-Intro-HOWTO-9.html" REL=previous>
 <LINK HREF="Bash-Prog-Intro-HOWTO.html#toc10" REL=contents>
</HEAD>
<BODY>
<A HREF="Bash-Prog-Intro-HOWTO-11.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO-9.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO.html#toc10">Ìܼ¡¤Ø</A>
<HR>
<H2><A NAME="s10">10. ¤½¤Î¾¤Î¥¹¥¯¥ê¥×¥È</A>     </H2>

<H2><A NAME="ss10.1">10.1 read ¤ò»È¤Ã¤Æ¥æ¡¼¥¶¤ÎÆþÎϤòÆɤ߹þ¤à</A>
</H2>

<P>¥æ¡¼¥¶¤Ë²¿¤é¤«¤ÎÆþÎϤòÂ¥¤·¤¿¤¤¤È»×¤¦¾ì¹ç¤¬¤è¤¯¤¢¤ë¤â¤Î¤Ç¤¹¡£¤½¤ì¤ò¼Â¸½¤¹¤ëÊý
Ë¡¤Ï¤¤¤¯¤Ä¤«Â¸ºß¤·¤Þ¤¹¤¬¡¢°Ê²¼¤Ï¤½¤ì¤é¤Î¤¦¤Á¤Î¤Ò¤È¤Ä¤Ç¤¹¡£
<P>
<BLOCKQUOTE><CODE>
<PRE>
        #!/bin/bash
        echo Please, enter your name
        read NAME
        echo "Hi $NAME!"
        
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>¾åµ­¤ÎÊÑ·Á¤È¤·¤Æ¡¢<CODE>read</CODE> ¤ò»È¤Ã¤ÆÊ£¿ô¤ÎÃͤò¼õ¤±¼è¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£
¼¡¤ÎÎãÂê¤Ï¤½¤ì¤òÌÀ¤é¤«¤Ë¤¹¤ë¤â¤Î¤Ç¤¹¡£
<P>
<BLOCKQUOTE><CODE>
<PRE>
        #!/bin/bash
        echo Please, enter your firstname and lastname
        read FN LN 
        echo "Hi! $LN, $FN !"
        
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>    
<H2><A NAME="ss10.2">10.2 ¿ôÃͤÎɾ²Á</A>
</H2>

<P>¥³¥Þ¥ó¥É¥é¥¤¥ó(¤¢¤ë¤¤¤Ï¥·¥§¥ë)¤Ç¡¢¼¡¤Î¤è¤¦¤ËÂǤäƤߤƤ¯¤À¤µ¤¤¡£
<P>
<BLOCKQUOTE><CODE>
<PRE>
        $ echo 1 + 1
        
</PRE>
</CODE></BLOCKQUOTE>
<P><CODE>2</CODE> ¤¬½ÐÎϤµ¤ì¤ë¤È´üÂÔ¤·¤Æ¤¤¤¿¤Ê¤é¡¢¤¬¤Ã¤«¤ê¤·¤¿¤³¤È¤Ç¤·¤ç¤¦¡£
<CODE>bash</CODE> ¤Ë¿ôÃͤò·×»»¤µ¤»¤¿¤¤¤È¤­¤Ï¡¢¤É¤¦¤·¤¿¤é¤¤¤¤¤Î¤Ç¤·¤ç¤¦¡©
²ò·èºö¤Ï¼¡¤Î¤è¤¦¤Ë¤¹¤ë¤³¤È¤Ç¤¹¡£
<BLOCKQUOTE><CODE>
<PRE>
        $ echo $((1 + 1))
        
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>¾åµ­¤Ç¤Ï¡¢¤è¤ê¥í¥¸¥«¥ë¤Ê½ÐÎϤ¬¤Ê¤µ¤ì¤¿¤³¤È¤È»×¤¤¤Þ¤¹¡£¤³¤ì¤Ï¿ô¼°¤òɾ²Á¤·¤¿
¤È¤¤¤¦¤³¤È¤Ç¤¹¡£¤Þ¤¿¡¢¼¡¤Î¤è¤¦¤Êɽ¸½¤Ç¤âƱ¤¸¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
<P>
<BLOCKQUOTE><CODE>
<PRE>
        $ echo $[ 1 + 1 ]
        
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>ʬ¿ô¤ä¤¢¤ë¤¤¤Ï¤â¤Ã¤ÈÊ£»¨¤Ê¿ô³ØŪ½èÍý¤¬É¬Íפˤʤ俾ì¹ç¡¢¤¢¤ë¤¤¤Ï¿ô¼°¤ÇÍ·¤Ó
¤¿¤¤¤È¤­¤Ê¤É¤Ï¡¢¿ô¼°É¾²Á¤Î¤¿¤á¤Î <CODE>bc</CODE> ¤È¤¤¤¦¥³¥Þ¥ó¥É¤¬»È¤¨¤Þ¤¹¡£
¥³¥Þ¥ó¥É¥×¥í¥ó¥×¥È¾å¤Ç "<CODE>echo $[3/4]</CODE>" ¤È¼Â¹Ô¤·¤Æ¤â¡¢<CODE>bash</CODE> ¤Ï
À°¿ô¤Ç¤·¤«Åú¤¨¤òÊÖ¤»¤Ê¤¤¤Î¤Ç¡¢·ë²Ì¤Ï <CODE>0</CODE> ¤È¤Ê¤ê¤Þ¤¹¡£
¤·¤«¤·¡¢"<CODE>echo 3/4 | bc -l</CODE>" ¤È¼Â¹Ô¤¹¤ì¤Ð¡¢<CODE>0.75</CODE> ¤È¤¤¤¦Àµ¤·¤¤Åú
¤¨¤¬Ê֤äƤ­¤Þ¤¹¡£
<P>
<P>
<P>
<A NAME="finding_bash"></A> <H2><A NAME="ss10.3">10.3 bash ¤òõ¤¹ </A>
</H2>

<P>Mike ¤«¤é¤Î¥á¥Ã¥»¡¼¥¸¤ò·ÇºÜ¤·¤Þ¤¹¡£(¼Õ¼­¤ò¸«¤Æ¤¯¤À¤µ¤¤) 
<P>
<P>¤¢¤Ê¤¿¤Ï¤¤¤Ä¤â <CODE>#!/bin/bash</CODE> ¤È¤¤¤¦¤Î¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢<CODE>bash</CODE> 
¤¬¤É¤³¤Ë¤¢¤ë¤Î¤«Ãµ¤¹ÊýË¡¤òÎ㼨¤·¤¿¤Û¤¦¤¬¤¤¤¤¤È»×¤¤¤Þ¤¹¡£"<CODE>bash</CODE> ¤ò¤½¤Î
¾ì½ê¤ËÃÖ¤¤¤Æ¤·¤Þ¤¨¤Ð¤¤¤¤¤Î¤Ç¤¹¤¬¡¢¤¹¤Ù¤Æ¤Î¥Þ¥·¥ó¤¬¤½¤ì¤ò¤·¤Æ¤¤¤ë¤ï¤±¤Ç¤Ï¤¢¤ê
¤Þ¤»¤ó¡£¥ë¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê¤«¤é¡¢'<CODE>find ./ -name bash</CODE>' ¤ò¼Â¹Ô¤¹¤ì¤ÐÄÌ
¾ï¤Ïõ¤·½Ð¤»¤ë¤Ï¤º¤Ç¤¹¡£
<P>
<P>¥Á¥§¥Ã¥¯¤¹¤Ù¤­¤Ê¤Î¤Ï¡¢¼¡¤Î¤è¤¦¤Ê¾ì½ê¤Ç¤·¤ç¤¦¡£
<BLOCKQUOTE><CODE>
<PRE>
        ls -l /bin/bash
        ls -l /sbin/bash
        ls -l /usr/lodal/bin/bash
        ls -l /usr/bin/bash
        ls -l /usr/sbin/bash
        ls -l /usr/local/sbin/bash
        
</PRE>
</CODE></BLOCKQUOTE>
<P>(¤³¤ì°Ê³°¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ï¤¹¤°¤Ë»×¤¤É⤫¤Ó¤Þ¤»¤ó... ¥·¥¹¥Æ¥à¤¬°ã¤Ã¤Æ¤â¡¢
¤³¤ì¤Þ¤Ç¤Ï¤³¤ÎÃ椫¤é¸«¤Ä¤«¤ë¾ì¹ç¤¬¤Û¤È¤ó¤É¤Ç¤·¤¿¡£) 
¤½¤ì¤«¤é¡¢'<CODE>which bash</CODE>' ¤ò»È¤Ã¤Æ¤ß¤ë¤Î¤â¤¤¤¤¤È»×¤¤¤Þ¤¹¡£ 
<P>    
<H2><A NAME="ss10.4">10.4 ¥×¥í¥°¥é¥à¤ÎÌá¤êÃͤò³ÍÆÀ¤¹¤ëÊýË¡</A>
</H2>

<P><CODE>bash</CODE> ¤Ç¤Ï¡¢¥×¥í¥°¥é¥à¤ÎÌá¤êÃͤò <CODE>$?</CODE> ¤È¤¤¤¦Æüì¤ÊÊÑ¿ô¤ËÆþ¤ì¤Æ
¤ª¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
°Ê²¼¤Ï¡¢¥×¥í¥°¥é¥à¤ÎÌá¤êÃͤò³ÍÆÀ¤¹¤ëÊýË¡¤ò½ñ¤¤¤¿¤â¤Î¤Ç¤¹¡£¤¿¤À¤·¡¢
<CODE>/dada</CODE> ¤È¤¤¤¦¥Ç¥£¥ì¥¯¥È¥ê¤Ï¼Âºß¤·¤Þ¤»¤ó¡£(¤³¤ì¤â Mike ¤«¤é¤ÎÄó°Æ¤ò
ºÜ¤»¤¿¤â¤Î¤Ç¤¹)
<P>
<BLOCKQUOTE><CODE>
<PRE>
        #!/bin/bash
        cd /dada &amp;> /dev/null
        echo rv: $?
        cd $(pwd) &amp;> /dev/null
        echo rv: $?
        
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>    
<H2><A NAME="ss10.5">10.5 ¥³¥Þ¥ó¥É½ÐÎϤò³ÍÆÀ¤¹¤ëÊýË¡ </A>
</H2>

<P>°Ê²¼¤Î´Êñ¤Ê¥¹¥¯¥ê¥×¥È¤Ï¡¢¤¹¤Ù¤Æ¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¾å¤òõ¤·¤ÆÁ´Éô¤Î¥Æ¡¼¥Ö¥ë¤ò
ɽ¼¨¤¹¤ë¤È¤¤¤¦¤â¤Î¤Ç¤¹( <CODE>MySQL</CODE> ¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¤³¤È¤¬Á°Äó¤Ç
¤¹)¡£
¤³¤ÎÃæ¤Î '<CODE>mysql</CODE>' ¤È¤¤¤¦¥³¥Þ¥ó¥ÉÉôʬ¤òÊѹ¹¤·¤Æ¡¢Í­¸ú¤Ê¥æ¡¼¥¶Ì¾¤È¥Ñ¥¹
¥ï¡¼¥É¤¬»È¤¨¤ë¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
<P>
<BLOCKQUOTE><CODE>
<PRE>
        #!/bin/bash
        DBS=`mysql -uroot  -e"show databases"`
        for b in $DBS ;
        do
                mysql -uroot -e"show tables from $b"
        done
        
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>
<H2><A NAME="ss10.6">10.6 Ê£¿ô¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë</A>
</H2>

<P>¥³¥Þ¥ó¥É¥½¡¼¥¹¤È¤·¤ÆÊ£¿ô¤Î¥Õ¥¡¥¤¥ë¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
<P>ºîÀ®Í½Äê( TO DO )
<P>
<P>
<P>
<HR>
<A HREF="Bash-Prog-Intro-HOWTO-11.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO-9.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="Bash-Prog-Intro-HOWTO.html#toc10">Ìܼ¡¤Ø</A>
</BODY>
</HTML>