¼ø¶È»ñÎÁ/04

Introduction: ɸ½àÆþ½ÐÎÏ, ¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¡¤¥Ñ¥¤¥×

unix ¤Î½ÅÍפʥݥꥷ¡¼¤Î°ì¤Ä¤Ë

û¤¤Ã±½ã¤Ê¥×¥í¥°¥é¥à¤òÁȤ߹ç¤ï¤»¤ÆÊ£»¨¤ÊÆ°ºî¤ò¹Ô¤Ê¤¦

¤È¤¤¤¦¤â¤Î¤¬¤¢¤ë¡¥ ¤½¤Î¤¿¤á¤Î»ÅÁȤߤΰì¤Ä¤¬¡¤É¸½àÆþ½ÐÎϤȤ½¤ÎÀ©¸æ¤Ç¤¢¤ë¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¡¤¥Ñ¥¤¥×¥é¥¤¥ó¤Ç¤¢¤ë.

¤Þ¤º¾¯¤·´ðËÜŪ¤ÊÏäò¤¹¤ë¤È¡¤unix ¤Ç¤ÏÄ̾ï¤Î¥×¥í¥°¥é¥à¤Ï ¡Öɸ½àÆþÎϡסÖɸ½à½ÐÎϡסÖɸ½à¥¨¥é¡¼½ÐÎϡפȤ¤¤¦ÆÃÊ̤ÊÆþ½ÐÎÏÀè¤ò»ý¤Ã¤Æ¤¤¤ë¡¥
¤½¤·¤Æ¤³¤Î¡Öɸ½àÆþ½ÐÎϡפ¬·Ò¤¬¤ëÁê¼ê¤ò¥æ¡¼¥¶¡¼¤¬¼«Í³¤ËÀ©¸æ¤¹¤ë¤³¤È¤¬¤Ç¤­¡¤ ¤½¤ÎÊýË¡¤¬¡Ö¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¡×¤ä¡Ö¥Ñ¥¤¥×¥é¥¤¥ó¡×¤Ê¤Î¤Ç¤¢¤ë¡¥

¢£ ɸ½àÆþ½ÐÎϤȤ½¤ÎÀ©¸æ(¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¡¤¥Ñ¥¤¥×)¤ÎÍÍ»Ò ¢£
stdinout.png



¾å¿Þ¤Î¤è¤¦¤Ë¡¤¥×¥í¥°¥é¥à¤ÎÆþ½ÐÎÏÀè¤ò¡Ö¥×¥í¥°¥é¥à¤Î¼Â¹Ô»þ¤Ë¥æ¡¼¥¶¤¬¾¡¼ê¤ËÊѤ¨¤é¤ì¤ë¡×¤Î¤Ç¤¢¤ë¡¥ ¾å¤Ç½Ò¤Ù¤¿¥Ý¥ê¥·¡¼¤Ë¤è¤ê ¡Öunix ¤Ë¤Ïñµ¡Ç½¥×¥í¥°¥é¥à¤¬ ¤¿¤¯¤µ¤ó¤¢¤ë¡× ¤¿¤á¡¤¤³¤Îµ¡Ç½¤ÈÁȤ߹ç¤ï¤»¤ë¤È

¤Þ¤ë¤Ç¥×¥í¥°¥é¥ß¥ó¥°¤ò¤·¤¿¤«¤Î¤è¤¦¤Ê¡¤¤«¤Ê¤ê¼«Í³¤Ê¤³¤È¤¬
¥×¥í¥°¥é¥ß¥ó¥°ÉÔÍפǴÊñ¤Ë¼Â¸½¤Ç¤­¤ë



¤È¤¤¤¦¡Ö¤ª¤¤¤·¤¤¡×¾õ¶·¤¬ unix ¤Ë½Ð¸½¤¹¤ë¡¥ ¤³¤ì¤ÏËÜÅö¤ËÊØÍø¤Ê¤Î¤Ç¡¤¤¼¤Ò½¬ÆÀ¤·¤è¤¦.



Standard Input/Output: ɸ½àÆþ½ÐÎϤȤϲ¿¤«

unix ¤Ç¤Ï¥×¥í¥°¥é¥à¤Ï¥Á¥ã¥Í¥ë¡¤¤â¤·¤¯¤Ï ¥Ç¥¹¥¯¥ê¥×¥¿(¥Õ¥¡¥¤¥ëµ­½Ò»Ò) ¤È¤è¤Ð¤ì¤ë½ÐÆþ¤ê¸ý¥Õ¥¡¥¤¥ë¤òÍѤ¤¤Æ¥Ç¡¼¥¿¤ÎÆþ½ÐÎϤò¹Ô¤Ê¤¦. µ¡´ï¤ä´Ä¶­¤Ë°Í¸¤·¤Ê¤¤ÈÆÍÑÆþ½ÐÎϤò²Äǽ¤È¤¹¤ëÌÜŪ¤Ç¡¤ unix ¤Ç¤Ï¤³¤Î¤¦¤Á¤ÎºÇ½é¤Î 3¤Ä(0 ¡Á 2ÈÖ)¤Î¥Ç¥¹¥¯¥ê¥×¥¿¤òÆÃÊ̤ʤâ¤Î¤È¤·¤Æ·è¤á¤Æ¤¤¤ë. ¤³¤ì¤é¤¬É¸½àÆþ½ÐÎϤȤè¤Ð¤ì¤ë¤â¤Î¤Ç¤¢¤ê¡¤¼¡¤Î¤è¤¦¤ÊÀ­¼Á¤ò»ý¤Ã¤Æ¤¤¤ë.

ɸ½àÆþÎÏ(stdin)
¥×¥í¥°¥é¥à¤¬ÈÆÍѥǡ¼¥¿ÆþÎϤ˻Ȥ¦. »ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¡¤¥Ç¥Õ¥©¥ë¥ÈÃÍ(Ä̾ï¤ÏüËö¥­¡¼¥Ü¡¼¥É)¤¬ÍѤ¤¤é¤ì¤ë.
ɸ½à½ÐÎÏ(stdout)
¥×¥í¥°¥é¥à¤¬ÈÆÍѥǡ¼¥¿½ÐÎϤ˻Ȥ¦. »ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¡¤¥Ç¥Õ¥©¥ë¥ÈÃÍ(Ä̾ï¤ÏüËö¥Ç¥£¥¹¥×¥ì¥¤)¤¬ÍѤ¤¤é¤ì¤ë.
ɸ½à¥¨¥é¡¼½ÐÎÏ(stderr)
¥×¥í¥°¥é¥à¤¬¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ÎÈÆÍѽÐÎϤ˻Ȥ¦. »ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¡¤¥Ç¥Õ¥©¥ë¥ÈÃÍ(Ä̾ï¤ÏüËö¥Ç¥£¥¹¥×¥ì¥¤)¤¬ÍѤ¤¤é¤ì¤ë.

¤³¤ì¤éɸ½àÆþ½ÐÎϤˤè¤ë¥Ç¡¼¥¿¤ÎÆþ½ÐÎϤÎÁê¼ê¤Ï¥×¥í¥°¥é¥à¤òµ¯Æ°¤·¤¿¥·¥§¥ë¤¬·è¤á¤ëÌó«¤Ë¤Ê¤Ã¤Æ¤¤¤ë.

warning.png ²¿¤â»ØÄꤷ¤Ê¤¤¤È¤­(¥Ç¥Õ¥©¥ë¥È)¤Ï¡¤
'' (ÆþÎÏ)¥­¡¼¥Ü¡¼¥É ¢ª ¥×¥í¥°¥é¥à ¢ª (½ÐÎÏ)¥Ç¥£¥¹¥×¥ì¥¤ ''
¤È·Ò¤¬¤Ã¤Æ¤¤¤ë¡¥

Redirection: ¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó


ɸ½àÆþ½ÐÎÏÀè¤ò²¿¤Ë¤¹¤ë¤«¤Ï¥æ¡¼¥¶¡¼¤¬´Êñ¤ËÊѹ¹¤Ç¤­¤ë

¤³¤ì¤ò¾å¼ê¤Ë»È¤¨¤Ð¡¤Æ±¤¸¥×¥í¥°¥é¥à¤Î½ÐÎϤò¥Õ¥¡¥¤¥ë¤Ø½ÐÎϤ·¤¿¤ê¡¤¥Ç¥£¥¹¥×¥ì¥¤¤Ø½ÐÎϤ·¤¿¤ê¡¤ ½ÐÎϤµ¤»¤Ê¤«¤Ã¤¿¤ê¤ÈÊѹ¹¤¹¤ë¤³¤È¤ò¡Ö¥×¥í¥°¥é¥à¦¤ÇÁ´¤¯¹Íθ¤¹¤ë»ö¤Ê¤¯¡× ¹Ô¤Ê¤¦¤³¤È¤¬¤Ç¤­¤ë.

¤³¤Î¡Öɸ½àÆþ½ÐÎÏÀè¤òÊѹ¹¤¹¤ë¤³¤È¡×,¤¹¤Ê¤ï¤Áɸ½àÆþ½ÐÎϤÎÀ©¸æ¤ò¡¤(I/O)¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¤È¤è¤Ö.

¤½¤³¤Ç¡¤°Ê²¼¤Ë¡Ö°ì¤Ä¤Î¥×¥í¥°¥é¥à¤ËÂФ¹¤ë¡×¶ñÂÎŪ¤Ê¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¤ÎÊýË¡¤ò¼¨¤½¤¦.
warning.png Æó¤Ä¤Î¥×¥í¥°¥é¥à¤ÎÆþ½ÐÎϤòľÀÜ·Ò¤²¤Æ¤·¤Þ¤¦¡ÖƱ»þ¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¡×¤ÏÆÃÊ̤ˡ֥ѥ¤¥×¥é¥¤¥ó¡×¤È¸Æ¤Ð¤ì¤ë. ¾Ü¤·¤¯¤Ï¸å½Ò¤¹¤ë.

ʸˡ¤¬¥·¥§¥ë¤Ë¤è¤Ã¤Æ¤ï¤º¤«¤Ë°Û¤Ê¤ë¤¿¤á¡¤°Ê²¼¤Ë sh ·Ï¤È csh ·Ï¤È¤Ë¤ï¤±¤Æ¼¨¤·¤Æ¤ª¤¯.
(¿¤¯¤Î³ØÀ¸¤Ï¡¤¤¿¤Ö¤ó bash ¤ò»È¤Ã¤Æ¤¤¤ë¤À¤í¤¦¤«¤é¡¤¤È¤ê¤¢¤¨¤º sh ·Ï¤ÎÊý¤À¤±¤ò¤ß¤Æ¤ª¤±¤Ð¤è¤¤¤À¤í¤¦)


¿¤¹¤®¤ÆÎɤ¯Ê¬¤«¤é¤Ê¤¤¤È¤¤¤¦¾ì¹ç¤Ï, ÀÖ»ú ¤Ç½ñ¤«¤ì¤Æ¤¤¤ë3¥ö½ê¤òÍý²ò¤·¤Æ³Ð¤¨¤ë¤À¤±¤Ç¤â½½Ê¬¤À¤í¤¦.

How to use the redirection: ¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¤Î¤ä¤êÊý¡Ä ¥³¥Þ¥ó¥É̾¤Î¸å¤í¤Ë°Ê²¼¤Î¡Ö¤ª¤Þ¤¸¤Ê¤¤¡×¤ò¤Ä¤±¤ì¤Ð¤è¤¤

ÆþÎϤÎÊѹ¹
sh ·Ïcsh ·Ï°ÕÌ£
<␣hogeɸ½àÆþÎϤò hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤ËÊѹ¹¡¥
<<␣hoge
ÆâÍƹÔ1
ÆâÍƹÔ2
¡Ä
ÆâÍƹԺǸå
hoge
ɸ½àÆþÎϤòºÇ½é¤Î hoge ¤«¤é¼¡¤Î hoge ¤Þ¤Ç¤ÎÆâÍƤËÊѹ¹.
"Here Document" µ¡Ç½¤È¤è¤Ð¤ì¤ë*1.


ɸ½à½ÐÎϤÎÊѹ¹
sh ·Ïcsh ·Ï°ÕÌ£
>␣hogeɸ½à½ÐÎϤò hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤ËÊѹ¹¡¥
hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤±¤ì¤ÐºîÀ®¤µ¤ì¡¤
´û¤Ë¸ºß¤¹¤ë¤Ê¤é¤ÐÆâÍƤϾõ¤ì¤Æ¾å½ñ¤­¤µ¤ì¤Æ¤·¤Þ¤¦.
csh ·Ï¤ª¤è¤Ó¿·¤·¤á¤Î sh·Ï¤Ç noclobber ÊÑ¿ô¤ò¥»¥Ã¥È¤·¤Æ¤¢¤ë¤È¤­¤Ï¡¤
´û¤Ë hoge ¤¬Â¸ºß¤¹¤ë¤Ê¤é¤Ð¥¨¥é¡¼¤Ë¤Ê¤ë.
(ÂçÀڤʥե¡¥¤¥ë¤Ë¾å½ñ¤­¤·¤ÆÆâÍƤò¼º¤ï¤Ê¤¤¤¿¤á¤Îµ¡Ç½)
>¦␣hoge>!␣hoge(noclobber ÊÑ¿ô¤ò̵»ë¤·¤Æ) ɸ½à½ÐÎϤò hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤ËÊѹ¹.
noclobber ÊÑ¿ô¤ò¥»¥Ã¥È¤·¤Æ¤¢¤Ã¤Æ¤â̵»ë¤·¤Æ¶¯À©Åª¤Ë¾å½ñ¤­¤¹¤ë.
>>␣hogeɸ½à½ÐÎϤνÐÎϤò hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤ÎËöÈø¤ËÄɲ䷤Ƥ¤¤¯¡¥
hoge ¤¬Â¸ºß¤·¤Ê¤±¤ì¤ÐºîÀ®¤µ¤ì¤ë.
¤¿¤À¤·¡¤csh ·Ï¤Ç noclobber ÊÑ¿ô¤ò¥»¥Ã¥È¤·¤Æ¤¢¤ë¤È¤­¤Ï¡¤hoge ¤¬
¸ºß¤·¤Ê¤±¤ì¤Ð¥¨¥é¡¼¤Ë¤Ê¤ë.
>>!␣hoge(noclobber ÊÑ¿ô¤ò̵»ë¤·¤Æ) ɸ½à½ÐÎϤνÐÎϤò hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤ÎËöÈø¤ËÄɲ䷤Ƥ¤¤¯.


ɸ½à¥¨¥é¡¼½ÐÎϤâÊѹ¹
sh ·Ïcsh ·Ï°ÕÌ£
2>␣hogeɸ½à¥¨¥é¡¼½ÐÎϤò hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤ËÊѹ¹.
¥Õ¥¡¥¤¥ë¤Î¸ºß, noclobber ÊÑ¿ô¤È¤Î´Ø·¸¤Ï¾åµ­Æ±ÍÍ.
(¥³¥Þ¥ó¥É␣>␣hoge )␣>&␣bokeɸ½à½ÐÎϤò hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤Ë, ɸ½à¥¨¥é¡¼½ÐÎϤò boke ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤Ë³Æ¡¹Êѹ¹.
(ɸ½à¥¨¥é¡¼½ÐÎϤÀ¤±¤òÊѹ¹¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤)
¥Õ¥¡¥¤¥ë¤Î¸ºß, noclobber ÊÑ¿ô¤È¤Î´Ø·¸¤Ï¾åµ­Æ±ÍÍ.
>␣hoge␣2>&1>&␣hogeɸ½à½ÐÎϤÈɸ½à¥¨¥é¡¼½ÐÎϤνÐÎϤòξÊý¤È¤â hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤ËÊѹ¹.
¥Õ¥¡¥¤¥ë¤Î¸ºß, noclobber ÊÑ¿ô¤È¤Î´Ø·¸¤Ï¾åµ­Æ±ÍÍ.
>¦␣hoge␣2>&1>&!␣hoge(noclobber ÊÑ¿ô¤ò̵»ë¤·¤Æ) ɸ½à½ÐÎϤÈɸ½à¥¨¥é¡¼½ÐÎϤνÐÎÏξÊý¤È¤â hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤ËÊѹ¹.
noclobber ÊÑ¿ô¤ò¥»¥Ã¥È¤·¤Æ¤¢¤Ã¤Æ¤â̵»ë¤·¤Æ¶¯À©Åª¤Ë¾å½ñ¤­¤¹¤ë.
>>␣hoge␣2>&1>>&␣hogeɸ½à½ÐÎϤÈɸ½à¥¨¥é¡¼½ÐÎϤνÐÎϤÎξÊý¤ò hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤ÎËöÈø¤ËÄɲ䷤Ƥ¤¤¯.
¥Õ¥¡¥¤¥ë¤Î¸ºß, noclobber ÊÑ¿ô¤È¤Î´Ø·¸¤Ï¾åµ­Æ±ÍÍ.
>>&!␣hoge(noclobber ÊÑ¿ô¤ò̵»ë¤·¤Æ) ɸ½à½ÐÎϤÈɸ½à¥¨¥é¡¼½ÐÎϤνÐÎÏξÊý¤È¤â hoge ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤ÎËöÈø¤ËÄɲ䷤Ƥ¤¤¯.



Gnome-Preferences.png ¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¤Î¼ÂÎã

Î㤨¤Ð¡¤ ls␣-lg ¤Î·ë²Ì¤ò¤æ¤Ã¤¯¤êÄ´¤Ù¤¿¤¤¤È¤·¤è¤¦. ¤³¤ì¤Ï½ÐÎÏ·ë²Ì¤ò¥Õ¥¡¥¤¥ë¤Ë¤·¤Æ¤ª¤¤¤Æ¤«¤é¡¤¤¸¤Ã¤¯¤êÄ´¤Ù¤ë¤Î¤¬Îɤ¤. ¶ñÂÎŪ¤Ë¤Ï¡¤

ls␣-lg␣>␣sample-file

¢¬ ls ¥³¥Þ¥ó¥É¤Î½ÐÎÏÀè¤ò¡¤sample-file ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤Ë¥ê¥À¥¤¥ì¥¯¥È¤·¤Æ¤¤¤ë

¤È¤¹¤ì¤Ð¡¤ sample-file ¤È¤¤¤¦Ì¾Á°¤Î¥Õ¥¡¥¤¥ë¤Ë ls␣-lg ¤Î·ë²Ì¤¬¼ý¤á¤é¤ì¤ë. ¤À¤«¤é¡¤Î㤨¤Ð less ¥³¥Þ¥ó¥É¤ò»È¤Ã¤Æ less␣sample-file ¤È¤¹¤ë¤È

 ¹ç·× 9756
 -rw-r--r--    1 ot-026fd others          0 May 11 14:32 #.xemacs#
 -rw-r--r--    1 ot-026fd others         36 May 11 14:34 #test.txt#
 drwx--s--x   23 ot-026fd others       2048 May 29 20:52 ./
 drwxr-sr-x   43 root     sys          1024 Apr  8 18:54 ../
 -rw-r--r--    1 ot-026fd others          0 May 11 08:47 .Change2tcsh
 -rw-------    1 ot-026fd others        505 May 28 16:14 .ICEauthority
 drwxr-sr-x    3 ot-026fd others        512 May 24 13:57 .Mathematica/
 -rw-r--r--    1 ot-026fd others      23158 Apr 15 22:56 .RealNetworks_RealMediaSDK_60
 -rw-r--r--    1 ot-026fd others        485 Apr 15 22:56 .RealNetworks_RealPlayer_60
 -rw-r--r--    1 ot-026fd others         92 Apr 15 22:56 .RealNetworks_RealShared_00
 drwxr-sr-x    3 ot-026fd others        512 May  8 14:53 .Wnn6/
 ¡Äά¡Ä

¤È¤¤¤¦¤è¤¦¤Ë¡¤Ãæ¿È¤ò¤¤¤Ä¤Ç¤â·«¤êÊÖ¤·¤æ¤Ã¤¯¤ê¸«¤ë¤³¤È¤¬¤Ç¤­¤ë.

¤µ¤é¤Ë¡¤¤³¤³¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤ò¥µ¥¤¥º½ç¤Ë¥ê¥¹¥È¥¢¥Ã¥×¤·¤Æ¤ß¤¿¤¤¤Ê¡Á ¤È»×¤Ã¤¿¤È¤·¤è¤¦.
¤¹¤ë¤È¡¤sort ¥³¥Þ¥ó¥É(Ãæ¿È¤òʤ٤ë)¤ò»È¤Ã¤Æ¡¤ sample-file ¤ÎÃæ¿È¤Î¡¤¤³¤Î¾ì¹ç¤Ï 5 ÈÖÌܤÎÍ×ÁǤòÂ礭¤¤½ç¤Ëʤ٤ì¤Ð¤è¤¤.
warning.png ls␣-lg ¥³¥Þ¥ó¥É¤Î·ë²Ì¤Î²¿ÈÖÌܤ˥ե¡¥¤¥ë¥µ¥¤¥º¤¬É½¼¨¤µ¤ì¤ë¤«¤Ï´Ä¶­¤Ë°Í¸¤¹¤ë¤Î¤Ç¡¤¼«Ê¬¤Ç¿ô¤¨¤Æ¤«¤é¼Â¹Ô¤·¤è¤¦¡¥

¤³¤Î¥±¡¼¥¹¤Ç¤Ï¡¤ÆþÎϤȽÐÎϤÎξÊý¤ò¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¤¹¤ì¤ÐÊØÍø¤À. ¤À¤«¤éÎ㤨¤Ð°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ì¤Ð¤è¤¤.

sort␣-k␣5␣-nr␣<␣sample-file␣>␣sample-file2

¢¬ sort ¥³¥Þ¥ó¥É¤ÎÆþÎÏÀè¤ò sample-file ¤Ë¡¤½ÐÎÏÀè¤ò sample-file2 ¤Ë¥ê¥À¥¤¥ì¥¯¥È¤·¤Æ¤¤¤ë

¤³¤¦¤¹¤ì¤Ð¡¤ sample-file2 ¤Ë˾¤ß¤Î·ë²Ì¤¬Æþ¤Ã¤Æ¤¤¤ë.



notes.png ¼Â½¬

  1. ¾å¤Ë¼¨¤·¤¿¼ÂÎã¤ÈƱ¤¸ºî¶È¤ò¤ä¤Ã¤Æ¤ß¤ë.
  2. ¤µ¤é¤Ë¡¤Æ±ÍͤÎÊýË¡¤Ç¡¤ Æó¤Ä¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ÎÃæ¤Ç¥µ¥¤¥º¤ÎÂ礭¤ÊÊý¤«¤é½ç¤Ë5¤Ä¤Î¥Õ¥¡¥¤¥ë¤ò¥ê¥¹¥È¥¢¥Ã¥×¤¹¤ë¤Ë¤Ï¤É¤¦¤·¤¿¤é¤è¤¤¤«¹Í¤¨¤è. ¤½¤·¤Æ¼ÂºÝ¤Ë»î¤·¤Æ¤ß¤è.

Tips of redirection: ³Ð¤¨¤Æ¤ª¤¯¤ÈÊØÍø¤Ê¥ê¥À¥¤¥ì¥¯¥ÈÀè /dev/null

¾å¤Îɽ¤ò¸«¤Æ¤âʬ¤«¤ë¤è¤¦¤Ë¡¤¥ê¥À¥¤¥ì¥¯¥ÈÀè¤Ë¤ÏÄ̾ï¤Ï¥Õ¥¡¥¤¥ë¤ò»ØÄꤹ¤ë.
¤³¤Î»þ¡¤unix ¤Ë¸ºß¤¹¤ëÆÃÊ̤ʥե¡¥¤¥ë /dev/null ¤¬Èó¾ï¤ËÊØÍø¤Ë»È¤¨¤ë¤Î¤Ç³Ð¤¨¤Æ¤ª¤³¤¦.

¤³¤Î¥Õ¥¡¥¤¥ë¤Ï¡Ö¥Ö¥é¥Ã¥¯¥Û¡¼¥ë¥Õ¥¡¥¤¥ë¡×¤È¤Ç¤â¸À¤¦¤Ù¤­¼¡¤ÎÀ­¼Á¤ò»ý¤Ã¤Æ¤¤¤ë.

  • ɸ½àÆþÎÏÀè¤Ë»ØÄꤹ¤ë¤È¡¤¡Ö²¿¤â½Ð¤Æ¤³¤Ê¤¤¡×
  • ɸ½à½ÐÎÏÀè¤Ë»ØÄꤹ¤ë¤È¡¤¡ÖÁ´¤Æ°û¤ß¹þ¤ó¤Ç¡¤²¿¤âÊѲ½¤·¤Ê¤¤¡×

¤è¤Ã¤Æ¡¤¤³¤ÎÀ­¼Á¤ò»È¤Ã¤Æ¼¡¤Î¤è¤¦¤Ê¤³¤È¤¬¤Ç¤­¤ë.

(¶õ¤Ã¤Ý¤Î)¿·¤·¤¤¥Õ¥¡¥¤¥ë¤òºî¤ì¤ë.
cp␣/dev/null␣¥Õ¥¡¥¤¥ë̾

¤È¤¹¤ë¤È¡¤¿·¤·¤¯(¶õ¤Ã¤Ý¤Î)¥Õ¥¡¥¤¥ë¤¬ºî¤é¤ì¤ë.
¿·¤·¤¯¥Õ¥¡¥¤¥ë¤òºîÀ®¤¹¤ëÊýË¡¤È¤·¤Æ¤Ï¡¤Â¾¤Ë touch ¥Õ¥¡¥¤¥ë̾ ¤È¤¹¤ë¤È¤¤¤¦ÊýË¡¤¬¤è¤¯ÃΤé¤ì¤Æ¤¤¤ë.
warning.png ¥Õ¥¡¥¤¥ë¤òºî¤ë¤Ë¤Ï¾¤Ë¤âÍÍ¡¹¤Ê¤Ò¤Í¤¯¤ì¤¿ÊýË¡¤¬¹Í¤¨¤é¤ì¤ë. ¤¤¤í¤¤¤í¹Í¤¨¤Æ¤ß¤è.

¤È¤Ã¤Æ¤ª¤¯É¬ÍפΤʤ¤½ÐÎϤò¼Î¤Æ¤ë¤³¤È¤¬¤Ç¤­¤ë(¤·¤«¤âÁÇÁ᤯)
Î㤨¤Ð¡¤

¥³¥Þ¥ó¥É␣>␣/dev/null␣ 2>&1     ¡Ä sh ·Ï¤Î¾ì¹ç

¥³¥Þ¥ó¥É␣>&␣/dev/null     ¡Ä csh ·Ï¤Î¾ì¹ç

¤È¤¹¤ì¤Ð¡¤ ɸ½à½ÐÎϤÈɸ½à¥¨¥é¡¼½ÐÎϤÎξÊý¤¬¥Ö¥é¥Ã¥¯¥Û¡¼¥ë¤Ø¤È¾Ã¤¨¤Æ¤¤¤¯¤³¤È¤Ë¤Ê¤ë.
¤½¤ó¤Ê¤³¤È¤ò¤·¤¿¤¯¤Ê¤ë¾ìÌ̤¬¤¢¤ë¤Î¤«? ¤È»×¤¦¤«¤â¤·¤ì¤Ê¤¤¤¬¡¤ ¤³¤ì¤¬¤¢¤ë¤Î¤À. Î㤨¤Ð¡¤ ¥¸¥ç¥Ö¤ò¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Ç¼Â¹Ô¤µ¤»¤Æ¤¤¤Æ¡¤¤½¤Î½ÐÎϤ¬¼ÙËâ¤Ê»þ¤ä¡¤ ¥³¥Þ¥ó¥É¤ò nohup ¤Ç¼Â¹Ô¤µ¤»¤ë¾ì¹ç¡¤ ¥×¥í¥°¥é¥à¤Î·×»»Â®Å٤ʤɤò½ã¿è¤Ë¬Äꤹ¤ë¤¿¤á¤Ë¥Ç¡¼¥¿¤Î½ÐÎϤ˻þ´Ö¤¬¤«¤«¤ë¤Èº¤¤ë»þ¡¤¤Ê¤É¤¬¤½¤ì¤Ë¤¢¤¿¤ë.

¾¤Ë¤â¡¤¥Ç¥Ð¥Ã¥°¾ðÊó¤Ê¤É¤ò¾ï¤Ë¥¨¥é¡¼½ÐÎϤ˽Ф¹¤³¤È¤Ë¤·¤Æ¤ª¤¤¤Æ¡¤ ÉÔÍפʤȤ­¤Ï¥¨¥é¡¼½ÐÎÏÀè¤ò /dev/null ¤Ë¤·¤Æ¤ª¤¯¡¤¤È¤¤¤¦»È¤¤Êý¤â¤Ç¤­¤ë.

Pipe: ¥Ñ¥¤¥×

¸¶ÍýŪ¤Ë¤Ï¡¤¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¤ò»È¤¨¤Ð

[¥Õ¥¡¥¤¥ë¤òÇ޲𤷤¿¥×¥í¥°¥é¥à¤ÎÀܳ]

Program A ¢ª(½ÐÎÏ)¢ª ¥Õ¥¡¥¤¥ë ¢ª(ÆþÎÏ)¢ª Program B



¤È¤·¤ÆÊ£¿ô¤Î¥×¥í¥°¥é¥à¤ÎÆþ½ÐÎϤò¥Õ¥¡¥¤¥ë¤òÇ޲𤷤ƷҤ²¤é¤ì¤ë¡¥ ¤·¤«¤·¡¤·Ò¤²¤ë¤À¤±¤Ê¤é¤Ð¥Õ¥¡¥¤¥ë¤òÌÀ¼¨Åª¤Ë»ØÄꤹ¤ë¤Î¤Ï̵Â̤ʤ¦¤¨¡¤´Ö°ã¤¤¤Î¤â¤È¤Ç¤â¤¢¤ë¡¥

¤½¤³¤Ç¡¤ Program A ¤Îɸ½à½ÐÎÏ¤È Program B ¤Îɸ½àÆþÎϤòľÀÜ·Ò¤¤¤Ç¤·¤Þ¤¦ÊýË¡¤¬ unix ¤Ë¤ÏÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë.
¤³¤ÎƱ»þ¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¤È¤Ç¤â¤è¤Ö¤Ù¤­ÊýË¡¤Ï¡¤ ¡Ö¥Ñ¥¤¥×¡×¤â¤·¤¯¤Ï¡Ö¥Ñ¥¤¥×¥é¥¤¥ó¡×¤È¸Æ¤Ð¤ì¡¤¼¡¤Î¤è¤¦¤Ë»È¤¦.

¢£ ¥Ñ¥¤¥×¤Î»È¤¤Êý ¢£

sh ·Ïcsh ·Ï°ÕÌ£
Program A ␣¦␣ Program BProgram A ¤Îɸ½à½ÐÎϤò Program B ¤Îɸ½àÆþÎϤȤ·¤ÆÅϤ¹.
Program A␣2>&1¦␣Program BProgram A ␣¦&␣ Program BProgram A ¤Îɸ½à½ÐÎϤÈɸ½à¥¨¥é¡¼½ÐÎϤò Program B ¤Îɸ½àÆþÎϤȤ·¤ÆÅϤ¹.

warning.png ¥Ñ¥¤¥×¤Ï¹¥¤­¤Ê¤À¤±²¿Ãʤˤâ½Å¤Í¤ë¤³¤È¤¬¤Ç¤­¤ë!!

Gnome-Preferences.png ¥Ñ¥¤¥×¤Î¼ÂÎã

Î㤨¤Ð¡¤ ps␣axu ¤Î·ë²Ì¤ò²èÌ̤Ǹ«¤ë¤È¤·¤è¤¦. ¤½¤Î¤Þ¤Þ¤³¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤È, ÂçÎ̤Υǡ¼¥¿¤¬½ÐÎϤµ¤ì¤Æ²èÌ̾å¤òή¤ì¤Æ¤¤¤Ã¤Æ¤·¤Þ¤¦¤Î¤Ï·Ð¸³¤·¤Æ¤¤¤ë¤À¤í¤¦. ¤³¤¦¤¤¤¦¤È¤­¤Ï¡¤less ¥³¥Þ¥ó¥É¤Ê¤É¤òÍѤ¤¤Æ¡¤°ì²èÌ̤º¤Äɽ¼¨¤µ¤»¤ë¤Î¤¬ÄêÀФǤ¢¤ë. ¤½¤ì¤Ë¤Ï

ps␣axu␣|␣less

¢¬ ps ¥³¥Þ¥ó¥É¤Î½ÐÎÏ¤È less ¥³¥Þ¥ó¥É¤ÎÆþÎϤòľÀܥѥ¤¥×¤Ç·Ò¤¤¤Ç¤¤¤ë

¤È¤¹¤ì¤Ð¤è¤¤.
¤µ¤é¤Ë¡¤¤³¤Î·ë²Ì¤ò¥×¥í¥»¥¹¤Î̾Á°½ç¤ËÊ¤Ùľ¤¹¤³¤È¤Ë¤è¤Ã¤Æ¸«°×¤¯¤·¤¿¤¤¤Ê¡Á ¤È»×¤Ã¤¿¤È¤·¤è¤¦. ¤¹¤ë¤È¡¤sort ¥³¥Þ¥ó¥É¤ò»È¤Ã¤Æ¡¤¾å¤Î·ë²Ì¤òÊ¤Ùľ¤»¤ÐÎɤ¤. ¤½¤ì¤Ë¤Ï¤É¤¦¤¹¤ë¤«¤È¤¤¤¦¤È¡¤¥Ñ¥¤¥×¤òÆó²ó»È¤Ã¤Æ¡¤

ps␣axu␣|␣sort␣-k␣11␣|␣less

¢¬ ps ¥³¥Þ¥ó¥É¤Î½ÐÎÏ¤È sort ¥³¥Þ¥ó¥É¤ÎÆþÎϤò¥Ñ¥¤¥×¤Ç·Ò¤®¡¤¤µ¤é¤Ë sort ¥³¥Þ¥ó¥É¤Î½ÐÎÏ¤È less ¥³¥Þ¥ó¥É¤ÎÆþÎϤò¥Ñ¥¤¥×¤Ç·Ò¤¤¤Ç¤¤¤ë(¥Ñ¥¤¥×¤òÆóÃʻȤäƤ¤¤ë)
warning.png ps ¥³¥Þ¥ó¥É¤Î·ë²Ì¤Î²¿ÈÖÌÜ¤Ë¥×¥í¥»¥¹Ì¾¤¬É½¼¨¤µ¤ì¤ë¤«¤â´Ä¶­¤Ë°Í¸¤¹¤ë¡¥¼«Ê¬¤Ç¿ô¤¨¤Æ¤«¤é¼Â¹Ô¤·¤è¤¦¡¥

¤È¤¹¤ì¤Ð¡¤

 sb8015th  8377  0.0  2.8 16700 3660 ?        S       20:38   0:00 (dns helper)
 ot-026fd  8540  0.0  1.0  2384 1380 pts/0    S       21:04   0:00 -csh
 ot-026fd  8559  0.0  1.0  2384 1380 pts/0    R       21:19   0:00 -csh
 ot-026fd  8427  0.0  0.9  1900 1164 pts/0    S       20:48   0:00 -sh
 root      6796  0.4 12.2 41760 15644 ?       S       19:03   0:35 /etc/X11/X -au
 root      1575  0.0  0.3  3180  444 ?        S       14:21   0:00 /usr/bin/gdm -
 root      6797  0.0  1.2  3848 1652 ?        S       19:03   0:00 /usr/bin/gdm -
 sb8015th  8267  0.0  3.0  6712 3848 ?        S       20:38   0:00 /usr/bin/gnome
 sb8015th  8331  0.0  2.6  5304 3352 ?        S       20:38   0:00 /usr/bin/sawfi
 sb8015th  8356  0.9 18.2 31716 23340 ?       S       20:38   0:23 /usr/lib/netsc
 sb8015th  8305  0.0  2.4  5152 3128 ?        S       20:38   0:00 /usr/local/bin
 ¡Äά¡Ä

¤Ê¤É¤È¡¤¥×¥í¥»¥¹Ì¾½ç¤Ëʤó¤À·ë²Ì¤¬²èÌ̾å¤Ç°ì²èÌ̤º¤Ä¸«¤é¤ì¤ë¤È¤¤¤¦¤â¤Î¤À.

notes.png ¼Â½¬

  1. ¾å¤Ë¼¨¤·¤¿¼ÂÎã¤ÈƱ¤¸ºî¶È¤ò¤ä¤Ã¤Æ¤ß¤ë.
  2. ¤µ¤é¤Ë¡¤¥Ñ¥¤¥×¤ò»°ÃʻȤ¦Îã¤ò¹Í¤¨¤Æ¡¤¼ÂºÝ¤Ë»î¤·¤Æ¤ß¤è.

Useful command tee: ³Ð¤¨¤Æ¤ª¤¯¤ÈÊØÍø¤Ê¥³¥Þ¥ó¥É tee

¥ê¥À¥¤¥ì¥¯¥·¥ç¥ó¤ä¥Ñ¥¤¥×¤ò»È¤¦¤È¤­¤Ë¡¤ ¡Ö¥Õ¥¡¥¤¥ë¤Ë¤â¼è¤Ã¤Æ¤ª¤­¤¿¤¤¤±¤É¡¤ ²èÌ̤dzÎǧ¤·¤Ê¤¬¤éºî¶È¤Ç¤­¤Ê¤¤¤Î¤ÇÉ԰¤À¡× ¤È¤¤¤¦»×¤¤¤¬¤¢¤ë¤È»×¤¦.
¤³¤¦¤¤¤¦»þÊØÍø¤Ê¤Î¤¬ tee ¥³¥Þ¥ó¥É¤Ç¡¤ ¡Öɸ½àÆþÎϤòÊ£À½¤·¤Æ¡¤É¸½à½ÐÎϤȥե¡¥¤¥ë¤ÎξÊý¤Ë½ÐÎϤ¹¤ë¡×µ¡Ç½¤ò»ý¤Ä.

Gnome-Preferences.png tee¤Î¼ÂÎã

¤É¤¦»È¤¦¤«¤È¤¤¤¦¤È¡¤Î㤨¤ÐÀè¤Î ls␣-lg ¤Î·ë²Ì¤ò¥Õ¥¡¥¤¥ë¤Ë¼ý¤á¤ë¤È¤¤¤¦Îã¤ò¹Í¤¨¤Æ¤ß¤è¤¦.
¤³¤Îºî¶È¤òÀè¤Î¤ä¤êÊý ls␣-lg␣>␣file ¤Ç¤ä¤ë¤È¡¤ file ¤ÎÃæ¿È¤ò¸«¤ë¤Þ¤Ç¤É¤¦¤Ê¤Ã¤Æ¤¤¤ë¤«¤ï¤«¤é¤Ê¤¤.
¤·¤«¤·¡¤tee ¥³¥Þ¥ó¥É¤òÍѤ¤¤Æ¡¤

ls␣-lg␣|␣tee␣sample-file

¢¬ ls ¥³¥Þ¥ó¥É¤Î½ÐÎϤòɸ½à½ÐÎϤ˽Ф·¤Ê¤¬¤é¡¤¤«¤Ä¡¤sample-file ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤Ë¤â½ÐÎϤ¹¤ë

¤È¤¹¤ë¤È¡¤·ë²Ì¤Ï²èÌ̤ˤâ½ÐÎϤµ¤ì¤Ä¤Ä¡¤ sample-file ¤È¤¤¤¦Ì¾Á°¤Î¥Õ¥¡¥¤¥ë¤Ë¤â½ñ¹þ¤Þ¤ì¤ë¤³¤È¤Ë¤Ê¤ë.
¿µ½Å¤Ëºî¶È¤ò¹Ô¤Ê¤¤¤¿¤¤¡¤¤È¤¤¤¦»þ¤Ï¤³¤Î¥³¥Þ¥ó¥É¤ò¾å¼ê¤Ë»È¤¦¤Î¤¬Îɤ¤¤À¤í¤¦.
warning.png ºî¶È²áÄø¤òµ­Ï¿¤·¤Æ¤ª¤¯¡¤¤È¤¤¤¦°ÕÌ£¤Ç»÷¤¿¤è¤¦¤Ê¤â¤Î¤Ë script ¤È¤¤¤¦¥³¥Þ¥ó¥É¤¬¤¢¤ë¤³¤È¤Ï¾Ò²ðºÑ¤ß¤À. ¤É¤Á¤é¤â»È¤¤¤³¤Ê¤·¡¤Å¬Àڤ˻Ȥ¤Ê¬¤±¤è¤¦.


Command substitution: ÊØÍø¡ª ÀèÆɤßɾ²Á ``

¥·¥§¥ë¤Ë¤Ï¡¤¥³¥Þ¥ó¥ÉÃÖ´¹¤È¤¤¤¦ÊØÍø¤Êµ¡Ç½¤¬¤¢¤ë.
¤³¤ì¤Ï¡¤¥³¥Þ¥ó¥ÉÃæ¤Î ` (¥Ð¥Ã¥¯¥¯¥©¡¼¥È, µÕ°úÍÑÉä) ¤Ç°Ï¤ó¤ÀÉôʬ¤ò ¡ÖÀè¤Ë¼Â¹Ô¤·¤Æ¤½¤Î·ë²Ì¤ÇÃÖ¤­´¹¤¨¤ë¡× ¤È¤¤¤¦¤â¤Î¤Ç¤¢¤ë.

¤³¤ì¤Ë¤è¤Ã¤Æ¡¤¥³¥Þ¥ó¥É¤Î½ÐÎÏ·ë²Ì¤ò¤¢¤¿¤«¤âʸ»úÎó¤Î¤è¤¦¤Ë°·¤¨¤ë.
´Êñ¤Ë¸À¤¨¤Ð¡¤Ä̾ï¤Ê¤é¤Ðʬ¤±¤Æ¹Ô¤Ê¤¦Ê£¿ô¤ÎÁàºî¤ò°ì¹Ô¤Ë½ñ¤±¤ë¡¤¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë.

Gnome-Preferences.png ÀèÆɤßɾ²Á¤Î¼ÂÎã(1)

Î㤨¤Ð¡¤test-ÆüÉÕ ¤È¤¤¤¦Ì¾Á°¤Î¥Õ¥¡¥¤¥ë¤òºî¤ê¤¿¤¤¤Ê¡Á ¤È»×¤Ã¤¿¤È¤·¤è¤¦(ÆüÉÕÉôʬ¤Ï·îÆü¤Î4·å¤È¤«).
ÆüÉÕ¤òÆÀ¤ë¤Ë¤Ï¡¤date ¥³¥Þ¥ó¥É¤¬»È¤¨¤ë. ¤³¤ì¤Ï¥ª¥×¥·¥ç¥ó¤òŬÅö¤Ë»ØÄꤹ¤ì¤Ð¹¥¤­¤Ê·Á¼°¤Ç½ÐÎϤ¬ÆÀ¤é¤ì¤ëÊØÍø¤Ê¥³¥Þ¥ó¥É¤À.
Î㤨¤Ð date␣+%m%d ¤È¤¹¤ì¤Ð 4·å¤Î¿ô»ú¤Î·Á¤Ç¡Ö·î¡×¡ÖÆü¡×¤¬ÆÀ¤é¤ì¤ë.
¤½¤³¤Ç¡¤

touch␣test-`date␣+%m%d`

¢¬ date ¥³¥Þ¥ó¥É¤Î½ÐÎÏ·ë²Ì¤¬Ê¸»úÎó¤È¤Ê¤ë

¤È¤¹¤ë. ¤¹¤ë¤È¡¤¥³¥Þ¥ó¥ÉÃÖ´¹¤Ë¤è¤Ã¤Æ¡¤ ÀÖ»úÉôʬ¤¬Àè¤Ë¼Â¹Ô¤µ¤ì¤Æ¡¤·ë²Ì¤Î4·å¤Î¿ô»ú¤ËÃÖ¤­´¹¤¨¤é¤ì¤ë ¤¿¤á¡¤test-0529 ¤Ê¤É¤È¤¤¤¦(¶õ¤Ã¤Ý¤Î)¥Õ¥¡¥¤¥ë¤¬ºî¤é¤ì¤ë¤³¤È¤Ë¤Ê¤ë.
warning.png ¤³¤ì¤Î±þÍѤǡ¤¡Ö¡û¡û¤È¤¤¤¦¥×¥í¥»¥¹¤ò kill ¤¹¤ë´Êñ¤Ê¥³¥Þ¥ó¥É¡×¤È¤«¤âºî¤ë¤³¤È¤¬¤Ç¤­¤ë. ¤ï¤¶¤ï¤¶ ps␣axu ¥³¥Þ¥ó¥É¤ÇÄ´¤Ù¤Æ¡Á ¤È¤ä¤é¤º¤ËºÑ¤à¤Î¤Ç³Ú¤À. ¾Ü¤·¤¤³ØÀ¸¤Ï¾¯¤·¹Í¤¨¤Æ¤ß¤è¤¦(grep ¤ä awk ¤ò»È¤¦¤È¤è¤¤¤À¤í¤¦).

Gnome-Preferences.png ÀèÆɤßɾ²Á¤Î¼ÂÎã(2)

¤â¤¦¤Á¤ç¤Ã¤ÈÊ£»¨¤ÊÎã¤â¹Í¤¨¤Æ¤ß¤è¤¦. Î㤨¤Ð¡¤t ¤Ç»Ï¤Þ¤ë¥Õ¥¡¥¤¥ë̾¤ò¤â¤Ä¥Õ¥¡¥¤¥ë¤¬º£¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¤¤¯¤Ä¤¢¤ë¤«¤¶¤Ã¤È¤ß¤Æ¤ª¤­¤¿¤¤¡¤ ¤È»×¤Ã¤¿¤È¤·¤è¤¦. ¤¹¤ë¤È¡¤ls ¥³¥Þ¥ó¥É¤È wc ¥³¥Þ¥ó¥É(ñ¸ì¿ô¤ò¿ô¤¨¤ë)¤òÍѤ¤¤Æ

ls␣t*␣|␣wc␣-w

¤È¤¹¤ì¤Ð¡¤³ºÅö¤¹¤ë¥Õ¥¡¥¤¥ë¤¬ 3¤Ä¤¢¤ì¤Ð 3 ¤È¤¤¤¦Åú¤¨¤¬ÆÀ¤é¤ì¤ë.
¤Ç¡¤¤³¤Îºî¶È¤òÎɤ¯¹Ô¤Ê¤¦¤Î¤Ç¡¤¤³¤Î¥³¥Þ¥ó¥É¤ò alias ¤Ê¤É¤Ç´Êñ¤ËÆþÎϤǤ­¤ë¤è¤¦¤Ë¤·¤¿¤¤¤È¤·¤è¤¦(alias ¤Ë¤Ä¤¤¤Æ¤Ï¤³¤Î¼ø¶È¤Î¸åȾÉôʬ¤Ç¾ÜºÙ¤ò¼¨¤¹).


¤³¤ì¤Ï,

alias␣t-num='ls␣t*␣|␣wc␣-w'    ¡Ä sh ·Ï¤Î¾ì¹ç

alias␣t-num␣'ls␣t*␣|␣wc␣-w'    ¡Ä csh ·Ï¤Î¾ì¹ç

¤ÈÆþÎϤ·¤Æ¤ª¤±¤Ð¤è¤¤. ¤¢¤È¤Ï t-num ¤ÈÆþÎϤ¹¤ë¤À¤±¤Ç 3 ¤È¤« 4 ¤È¤«Åú¤¨¤¬ÆÀ¤é¤ì¤ë. ¤·¤«¤·¡¤¿ô»ú¤À¤±¤·¤«É½¼¨¤µ¤ì¤Ê¤¤¤Î¤ÇÌ£µ¤¤Ê¤¤. ¤½¤³¤Ç¡¤echo ¥³¥Þ¥ó¥É(ʸ»úÎó¤òɽ¼¨¤¹¤ë)¤ÈÁȤ߹ç¤ï¤»¤Æ¡¤

alias␣t-num='echo␣"`ls␣t*␣|␣wc␣-w`␣t*␣files␣exist."'

¤È¤¹¤ë(sh ·Ï¤Î¾ì¹ç). ¤¹¤ë¤È¡¤ t-num ¤ÈÆþÎϤ¹¤ë¤¿¤Ó¤Ë¡¤ ¥³¥Þ¥ó¥ÉÃÖ´¹¤Ë¤è¤Ã¤Æ¡¤ ÀÖ»úÉôʬ¤¬Àè¤Ë¼Â¹Ô¤µ¤ì¤Æ¡¤·ë²Ì¤Î¿ô»ú¤ËÃÖ¤­´¹¤¨¤é¤ì¤ë ¤¿¤á¡¤

 3 t* files exist.

¤Ê¤É¤È¤¤¤¦·ë²Ì¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ë.
warning.png ¤³¤¦¤¤¤¦¾ì¹ç¡¤Ã±¿ô·Á¤ÈÊ£¿ô·Á¤¬°Û¤Ê¤ë¤Î¤Ç¡¤Àµ¤·¤¤±Ñ¸ì¤Ë¤·¤¿¤«¤Ã¤¿¤éÌÌÅݤÀ(^-^).

notes.png ¼Â½¬

  1. tee ¥³¥Þ¥ó¥É¤ÈÀèÆɤßɾ²Á¤Ë´Ø¤·¤Æ¡¤ ¾å¤Ë¼¨¤·¤¿¼ÂÎã¤ÈƱ¤¸ºî¶È¤ò¤ä¤Ã¤Æ¤ß¤ë.



Customization of the shell: cui ´Ä¶­¤Î¥«¥¹¥¿¥Þ¥¤¥º -¥·¥§¥ëÀßÄê¤òÃæ¿´¤Ë-

unix ¤Ë¤Ï¡Ö¼«Í³ÅÙ¤ò¹â¤¯¡¤ÀßÄê¤Ï¸Ä¿Í¤Î¼«Í³¤Ë¡×¤È¤¤¤¦´ðËÜ»ÑÀª¤¬¤¢¤ë¡¥ ΢¤òÊÖ¤»¤Ð¡¤Å¬ÀÚ¤ÊÀßÄê¤ò°Õ¼±¤·¤Æ¹Ô¤Ê¤ï¤Ê¤¤¤È¤¤¤±¤Ê¤¤¤«¤â¡Ä¤È¤¤¤¦¤³¤È¤Ç¤â¤¢¤ë.
¤½¤³¤Ç¡¤¥·¥§¥ë¤ÎÀßÄê¤Ë¤Ä¤¤¤ÆɬÍ׺Ǿ®¸Â¤òÃΤäƤª¤³¤¦¡¥

Configuration file of the shell: ¥·¥§¥ë¤ÎÀßÄê¥Õ¥¡¥¤¥ë

¥·¥§¥ë¤ª¤è¤Ó¥·¥§¥ë¤«¤éµ¯Æ°¤µ¤ì¤ë¥³¥Þ¥ó¥É¤ÎÆ°ºî¤Î°ìÉô¤Ë±Æ¶Á¤òÍ¿¤¨¤ëÀßÄê¤Ï¡¤ °Ê²¼¤Î¤è¤¦¤Ê¥Õ¥¡¥¤¥ëÃæ¤Ç¹Ô¤Ê¤ï¤ì¤ë.

sh series: sh ·Ï

.bashrc
bash ¤ò¡ÖÈó¥í¥°¥¤¥ó¥·¥§¥ë¤ÇÂÐÏÃŪ¤Ë¡×»È¤¦¾ì¹ç¤ÎÀßÄê¤ò½ñ¤¯¥Õ¥¡¥¤¥ë. ¸å½Ò¤¹¤ë¤è¤¦¤Ë .bash_profile ¤«¤é¤â¤³¤Î¥Õ¥¡¥¤¥ë¤¬Æɹþ¤Þ¤ì¤ë¤Î¤¬ÉáÄ̤Ǥ¢¤ë¤¿¤á¡¤ üËöÀßÄê¤È¥Ç¥Õ¥©¥ë¥È¥³¥Þ¥ó¥Éµ¯Æ°°Ê³°¤Ï¤³¤Î¥Õ¥¡¥¤¥ë¤Ë½ñ¹þ¤á¤Ð¤è¤¤.
¥·¥§¥ë¤ÎÀßÄê¤Ë´Ø¤·¤Æ¤Ï¡¤Ä̾ï¤Ï¤³¤Î¥Õ¥¡¥¤¥ë¤ò¤¤¤¸¤ë¤À¤±¤ÇºÑ¤à¤À¤í¤¦.
.bash_profile
bash ¤ò¡Ö¥í¥°¥¤¥ó¥·¥§¥ë¤Ç¡×»È¤¦¾ì¹ç¤ÎÀßÄê¤ò½ñ¤¯¥Õ¥¡¥¤¥ë. üËöÀßÄê¤È¥Ç¥Õ¥©¥ë¥È¥³¥Þ¥ó¥Éµ¯Æ°Åù¤ò¤³¤Î¥Õ¥¡¥¤¥ë¤Ç¹Ô¤Ê¤¦¤Î¤¬Àµ¤·¤¤»Ñ¡¤¤À¤í¤¦. ¤½¤ì°Ê³°¤ÎÀßÄê¤Ï .bashrc ¤òÆɹþ¤ó¤Ç¹Ô¤Ê¤¦¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Î¤¬ÉáÄÌ.
.profile
sh ·Ï¥·¥§¥ë¶¦Ä̤˻Ȥ¨¤ëÀßÄê¥Õ¥¡¥¤¥ë. ¤·¤«¤·¡¤sh ·Ï¥·¥§¥ë¤òÍøÍѤ¹¤ë¿Í¤Ï¸½¾õ¤Ç¤Ï bash ¤ò»È¤¦¿Í¤¬Â¿¤¤¤À¤í¤¦¤«¤é¡¤ ¤¢¤Þ¤ê½ÐÈ֤Ϥʤ¤¤À¤í¤¦(^-^).
¤½¤Î¾
.profile Ãæ¤ÇÊÑ¿ô ENV ¤ËÀßÄꤷ¤¿¥Õ¥¡¥¤¥ë¤Ï¡ÖÂÐÏôĶ­¡×¤Ç¤Ï¼«Æ°Åª¤ËÆɹþ¤Þ¤ì¤ë. ¤·¤«¤·¤½¤Îµ¡Ç½¤ò»È¤¦¿Í¤Ï¾¯¤Ê¤¤¤«.

csh series: csh·Ï

.tcshrc
tcsh ¤ò»È¤¦¾ì¹ç¡¤É¬¤ºÆɹþ¤Þ¤ì¤ë¥Õ¥¡¥¤¥ë. ´Ä¶­¤Ë¤è¤é¤ºÆɹþ¤Þ¤ì¤ë¤¿¤á¡¤´°Á´¤Ë¶¦Ä̤˻Ȥ¨¤ëÀßÄê¤ò¤³¤Î¥Õ¥¡¥¤¥ë¤Ë½ñ¤¯. ¶ñÂÎŪ¤Ë¤Ï¡¤Ã¼ËöÀßÄê¤È¥Ç¥Õ¥©¥ë¥È¥³¥Þ¥ó¥Éµ¯Æ°°Ê³°¤ò¤³¤Î¥Õ¥¡¥¤¥ë¤Ë½ñ¹þ¤à¤«¡¤ ´Ä¶­¤òȽÄꤹ¤ë¤ä¤äÊ£»¨¤ÊÀßÄê¤ò½ñ¤¯¤«¤Ç¤¢¤ë. (´Ö°ã¤Ã¤¿ÀßÄê¤ò½ñ¤¯¤È¡¤¥í¥°¥¤¥ó¤·¤¿ÅÓü¤Ë¥í¥°¥¢¥¦¥È¤µ¤»¤é¤ì¤¿¤ê¤¹¤ë´ÖÈ´¤±¤Ê¤³¤È¤Ë¤Ê¤Ã¤¿¤ê¤¹¤ë)
¡Ä¤È¤Ï¤¤¤¨¡¤Æñ¤·¤¤¤³¤È¤¬Ê¬¤«¤é¤Ê¤¤¥¦¥Á¤Ï¤³¤Î¥Õ¥¡¥¤¥ë¤òÊÔ½¸¤·¤Æ¤¤¤ë¤À¤±¤ÇºÑ¤à.
.login
¥í¥°¥¤¥ó¤·¤¿»þ¤À¤±¡¤.(t)cshrc ¤ÎÆɹþ¤ß¤Î¸å¤ËÆɹþ¤Þ¤ì¤ë¥Õ¥¡¥¤¥ë. üËöÀßÄê¤È¥Ç¥Õ¥©¥ë¥È¥³¥Þ¥ó¥Éµ¯Æ°¤Ï¤³¤Î¥Õ¥¡¥¤¥ë¤Ë½ñ¹þ¤à¤Î¤¬Îɤ¤. ¾Ü¤·¤¤¤³¤È¤¬Ê¬¤«¤é¤Ê¤¤¥¦¥Á¤Ï¿¨¤é¤Ê¤¤Êý¤¬¤è¤¤¤À¤í¤¦.
.cshrc
csh ·Ï¥·¥§¥ë¶¦Ä̤˻Ȥ¨¤ëÀßÄê¥Õ¥¡¥¤¥ë. .tcshrc ¤ÎÂå¤ï¤ê¤Ë»È¤¦¿Í¤â¿¤¤.
¤½¤Î¾
.tcshrc Ãæ¤Ê¤É¤Ç source ¥³¥Þ¥ó¥É¤òÍѤ¤¤ÆÊÌ¥Õ¥¡¥¤¥ë¤òÆɹþ¤àÀßÄê¤Ë¤¹¤ë¤³¤È¤â¿¤¤. ¶ñÂÎŪ¤Ë¤Ï¡¤alias ¥³¥Þ¥ó¥É¤À¤±¤òÊÌ¥Õ¥¡¥¤¥ë¤Ë¤¹¤ë¤Ê¤É¤ÎÀßÄ꤬¤è¤¯¸«¤é¤ì¤ë.



Setting of shell variables: ÊÑ¿ô¤ÎÀßÄê: ¥·¥§¥ëÊÑ¿ô

¥·¥§¥ë¤¬¸ÇÍ­¤Ë»ý¤ÄÊÑ¿ô. ¥·¥§¥ë¼«¿È¤ÎÆ°ºî¤Ë¤«¤«¤ï¤ëÀßÄê¤ËÍѤ¤¤é¤ì¤ë.
̾Á°¤Ï¾®Ê¸»ú¤Çµ­½Ò¤¹¤ë¤³¤È¤¬Â¿¤¤.

ʸˡ
°ÕÌ£sh·Ïcsh·Ï
ºîÀ®, ÂåÆþÊÑ¿ô̾=ÃÍset␣ÊÑ¿ô̾=ÃÍ
ºï½üunset␣ÊÑ¿ô̾
ɽ¼¨set
»²¾È$ÊÑ¿ô̾



Shell variables: ÂåɽŪ¤Ê¥·¥§¥ëÊÑ¿ô

¥³¥Þ¥ó¥É¥µ¡¼¥Á¥Ñ¥¹(PATH: sh·Ï, path: csh ·Ï)
¥·¥§¥ë¤«¤é¥³¥Þ¥ó¥É¤òµ¯Æ°¤¹¤ë¤È¤­¤Ë¡¤ ¤É¤Î¥Ç¥£¥ì¥¯¥È¥ê¤«¤éõ¤·¤Æ¤¯¤ë¤Î¤«¥·¥§¥ë¤Ë¶µ¤¨¤Æ¤ª¤¯¤¿¤á¤Ë»È¤¦. ¤Ä¤Þ¤ê¡¤path ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ë¥³¥Þ¥ó¥É¤Ï¡¤ ¥³¥Þ¥ó¥É̾¤òÆþÎϤ¹¤ë¤À¤±¤Ç»ÈÍѤǤ­¤ë.
¤è¤¯Ê¬¤«¤é¤Ê¤¤¥¦¥Á¤ÏÊѹ¹¤·¤Ê¤¤¤Î¤¬¤è¤¤¤À¤í¤¦.
¥×¥í¥ó¥×¥È(PS1: sh·Ï, prompt: csh ·Ï)
¥×¥í¥ó¥×¥È¤È¤Ï¡¤¥·¥§¥ë¤ò»È¤Ã¤Æ¤¤¤ë¤È¤­¤Ë¥³¥Þ¥ó¥ÉÆþÎϹԤÎÀèƬÉôʬ¤Ë¥·¥§¥ë¤¬É½¼¨¤¹¤ëʸ»úÎó¤Ç¤¢¤ë.
Gnome-Preferences.png bash ¤Ç¤ÎÀßÄêÎã¡¥Î㤨¤Ð¡¤

PS1="(BAsh)\H<\u>\[\033[1;34m\]\w\[\033[0m\] <\!>"

¤ÈÆþÎϤ·¤Æ¤ß¤è¤¦¡¥¥×¥í¥ó¥×¥È¤¬¤³¤ÎÀßÄêÄ̤ê¤ËÊѲ½¤¹¤ë¡¥¤³¤ÎÀßÄê¤Ï¥í¥°¥¢¥¦¥È¤¹¤ë¤Þ¤ÇÍ­¸ú¤À¡¥ ¤³¤ì¤ò¥Õ¥¡¥¤¥ë .bashrc ¤ÎÃæ¤Ëµ­½Ò¤·¤Æ source␣.bashrc ¤ÈÆþÎϤ¹¤ë¤«¥í¥°¥¤¥ó¤¹¤ë¤Î¤Ç¤â¤è¤¤(¤½¤Î¾ì¹ç¤Ï¡¤¤³¤ÎÀßÄê¤Ï¤º¤Ã¤ÈÍ­¸ú¤Ë¤Ê¤ë)¡¥

¶ñÂÎŪ¤Ë¤¤¤í¤¤¤í¤¤¤¸¤Ã¤Æ¤ß¤¿¤±¤ì¤Ð¡¤ jman␣bash ¤â¤·¤¯¤Ï jman␣tcsh ¤È¤·¤Æ¡¤¡Ö¥×¥í¥ó¥×¥È¡×¤â¤·¤¯¤Ï¡ÖPrompt¡×¤Î¹àÌܤòÆɤá¤Ð¤è¤¤. ¾Ü¤·¤¯½ñ¤¤¤Æ¤¢¤ë.

¥Ò¥¹¥È¥ê(HISTSIZE: sh·Ï, history: csh·Ï)
¥·¥§¥ë¤¬ÍúÎò(history)¤ò¼è¤Ã¤Æ¤ª¤¯¥³¥Þ¥ó¥É¤Î¿ô. ¾¯¤·Â¿¤á¤Ë¤·¤Æ¤ª¤¯¤È¤è¤¤¤À¤í¤¦.

¥¨¥é¡¼½èÍý¡¤°ÂÁ´²½·Ï(ignoreeof, noclobber,noglob Åù)
¤¦¤Ã¤«¤ê¥ß¥¹¤äÃμ±ÉÔ­¤Ë¤è¤Ã¤ÆȯÀ¸¤¹¤ë»Ù¾ã¤ò¤Ê¤ë¤Ù¤¯ÍÞÀ©¤¹¤ë¤¿¤á¤ËÍѤ¤¤ë¤â¤Î. ¥ª¥ó¥é¥¤¥ó¥Þ¥Ë¥å¥¢¥ë¤ÇÄ´¤Ù¤è. ¤è¤¯Ê¬¤«¤é¤Ê¤¤¥¦¥Á¤Ï¤¤¤¸¤é¤Ê¤¤¤Î¤¬¤è¤¤.



Setting of environment variables: ÊÑ¿ô¤ÎÀßÄê: ´Ä¶­ÊÑ¿ô

¥·¥§¥ë¤«¤éµ¯Æ°¤µ¤ì¤ë¥³¥Þ¥ó¥É¤ÎÆ°ºîÀßÄê¤Ë¤«¤«¤ï¤ëÊÑ¿ô. ´Ä¶­ÊÑ¿ô¤ò¤É¤¦ÍøÍѤ¹¤ë¤«¤Ï¥³¥Þ¥ó¥É¤¬·è¤á¤ë¤³¤È¤Ç¤¢¤ë.
̾Á°¤ÏÂçʸ»ú¤Çµ­½Ò¤¹¤ë¤³¤È¤¬Â¿¤¤.

ʸˡ
°ÕÌ£sh·Ïcsh·Ï
ºîÀ®, ÂåÆþ(¥·¥§¥ëÊÑ¿ô¤È¤·¤ÆºîÀ®¤·¤¿¸å)
export␣ÊÑ¿ô̾
setenv␣ÊÑ¿ô̾␣ÃÍ
ºï½üunset␣ÊÑ¿ô̾unsetenv␣ÊÑ¿ô̾
ɽ¼¨set or envprintenv
»²¾È$ÊÑ¿ô̾



Environment variables: ÂåɽŪ¤Ê´Ä¶­ÊÑ¿ô

¥¨¥Ç¥£¥¿(EDITOR)
¥×¥í¥°¥é¥à¤Ë¤è¤Ã¤Æ¤Ï¡¤ÅÓÃæ¤Ç¥¨¥Ç¥£¥¿¤òµ¯Æ°¤¹¤ë¤â¤Î¤¬¤¢¤ë. ¤½¤¦¤·¤¿»þ¤Ë¡¤¤É¤Î¥¨¥Ç¥£¥¿¤òµ¯Æ°¤¹¤ë¤Î¤«¤ò¤³¤ÎÊÑ¿ô¤ÇÀßÄê¤Ç¤­¤ë. ÀßÄꤷ¤Æ¤ª¤«¤Ê¤¤¤È vi ¤¬µ¯Æ°¤·¤¿¤ê¤¹¤ë¤Î¤Ç¡¤¼«Ê¬¤Î´·¤ì¤¿¥¨¥Ç¥£¥¿¤òÀßÄꤷ¤Æ¤ª¤¯¤Î¤¬¤è¤¤.

¥Ú¡¼¥¸¥ã(PAGER)
¥×¥í¥°¥é¥à¤Ë¤è¤Ã¤Æ¤Ï¡¤ÅÓÃæ¤Ç more ¤ä less ¤È¤¤¤Ã¤¿¥Ú¡¼¥¸¥ã¤òµ¯Æ°¤¹¤ë¤â¤Î¤¬¤¢¤ë¤¬¡¤ ¤½¤ÎºÝ¤Ë¤É¤Î¥Ú¡¼¥¸¥ã¤òµ¯Æ°¤¹¤ë¤Î¤«¤ò¤³¤ÎÊÑ¿ô¤ÇÀßÄê¤Ç¤­¤ë. ÆüËܸì¤ËÂбþ¤·¤Æ¤¤¤Ê¤¤¥Ú¡¼¥¸¥ã¤À¤ÈÆüËܸ줬Æɤá¤Ê¤¤Åù¤Î»Ù¾ã¤¬À¸¤º¤ë¤Î¤Ç¡¤ ŬÀڤʥڡ¼¥¸¥ã¤ò¤òÀßÄꤷ¤Æ¤ª¤¯¤Î¤¬¤è¤¤.

¸À¸ì(LANG)
¤É¤Î¸À¸ì¤òÍѤ¤¤Æ¤¤¤ë¤«¡¤¤ò»ØÄꤹ¤ë. ¹Ôµ·¤Î¤è¤¤¥×¥í¥°¥é¥à¤Ê¤é¤Ð¤³¤Î´Ä¶­ÊÑ¿ô¤ò¸«¤ÆŬÀÚ¤ËÀßÄê¤òÊѤ¨¤Æ¤¯¤ì¤ë. ÆüËܸì¤òÍѤ¤¤ë¤Ê¤é¤Ð¡¤ Linux ¤äFreeBSD ¤Ç¤Ï ja_JP.UTF-8 ¤ä ja_JP.eucJP ¤Ê¤É¤ÈÀßÄꤹ¤ì¤Ð¤è¤¤.

üËö°À­(TERM, TERMCAP Åù)
üËö¤Î̾Á°¤äÀ­¼Á¤ò»ØÄꤹ¤ë. ¤è¤¯¤ï¤«¤é¤Ê¤¤¤±¤ì¤É¤â²¿¤«ÀßÄꤷ¤Ê¤±¤ì¤Ð¤¤¤±¤Ê¤¤¡¤¤È¤¤¤¦¾õÂÖ¤ËÄɤ¤¹þ¤Þ¤ì¤¿¤é(^-^)¡¤ TERM ¤Ë vt100 ¤òÀßÄꤷ¤Æ¤ª¤±¤Ð¤È¤ê¤¢¤¨¤º¤·¤Î¤²¤ë¤À¤í¤¦.

Activation of the configration: ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß

¥·¥§¥ë¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤ò½¤Àµ¤·¤Æ¡¤¤½¤Î¸ú²Ì¤ò¤ß¤ë¤¿¤á¤Ë¤Ï¤É¤¦¤·¤¿¤é¤è¤¤¤À¤í¤¦¤«?
¤¤¤Ã¤¿¤ó¥í¥°¥¢¥¦¥È¤·¤Æ¤Þ¤¿¥í¥°¥¤¥ó¤¹¤ë? ¤½¤ì¤Ï¡Ö´í¸±¡×¤À¡¥

warning.png ´Ä¶­¥«¥¹¥¿¥Þ¥¤¥º¤ÎÃí°ÕÅÀ
¥·¥§¥ë¤Î´Ä¶­¤ò¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¤¤ë¤È¤­¤Ë¡¤ ¡ÖÀßÄê¤Ë¤«¤Ê¤ê¸·¤·¤¤¥ß¥¹¤ò¤·¤Æ¤·¤Þ¤¤¡¤¥í¥°¥¤¥ó¤Ç¤­¤Ê¤¯¤Ê¤ë¡× ¤ÈÄ̾ï¥æ¡¼¥¶¤Ç¤Ï¤É¤¦¤·¤è¤¦¤â¤Ê¤¯¤Ê¤ë¤³¤È¤¬¤¢¤ë¡¥

¤³¤¦¤Ê¤é¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤è¤¦¤Ë¤Ï¡Ä

  1. (¸å½Ò¤Î) source ¥³¥Þ¥ó¥É¤Ç¤·¤Ã¤«¤ê³Îǧ¤¹¤ë
  2. ¥«¥¹¥¿¥Þ¥¤¥º¤¬½ª¤ï¤ë¤Þ¤ÇÀäÂÐ¤Ë¥í¥°¥¢¥¦¥È¤·¤Ê¤¤Ã¼Ëö¤ò°ì¤Ä¤Ï³ÎÊݤ·¤Æ¤ª¤¯
  3. ²¿¤«ÀßÄê¤òÊѤ¨¤¿¤éÊ̤ÎüËö(¥½¥Õ¥È)¤«¤é¥í¥°¥¤¥ó¤·¤Æ¥Æ¥¹¥È¤¹¤ë(= ¸½ºß¤ÎüËö(¥½¥Õ¥È)¤Ï¥í¥°¥¢¥¦¥È¤·¤Ê¤¤)

¤Ê¤É¤ÎÂкö¤ò¾ï¤Ë¤·¤Æ¤ª¤³¤¦¡¥

source command to read the configration: ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¥³¥Þ¥ó¥É: source

ÀßÄê¥Õ¥¡¥¤¥ë¤ò½¤Àµ¤·¤¿¸å¡¤¤¹¤°¤Ë¤½¤Î±Æ¶Á¤ò¤ß¤ë¤¿¤á¤Ë ¡ÖÀßÄê¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤à¡×¤Ë¤Ï¡¤

source␣¥Õ¥¡¥¤¥ë̾

¤È¤¹¤ì¤Ð¤è¤¤¡¥

warning.png ÁǤΠsh ¤Ï¤³¤Î¥³¥Þ¥ó¥É¤¬»È¤¨¤º¡¤
.␣¥Õ¥¡¥¤¥ë̾ (¥Ô¥ê¥ª¥É¡¤¶õÇò, ¥Õ¥¡¥¤¥ë̾)
¤È¤¤¤¦ÊýË¡¤·¤«»È¤¨¤Ê¤¤¤¬¡Ä¸½ºß¤Ï¤â¤¦µ¤¤Ë¤·¤Ê¤¯¤ÆÎɤ¤¤À¤í¤¦¡¥



notes.png ¼Â½¬

  1. ¾å¤Ë¼¨¤·¤¿Îã¤ò¤ß¤Ê¤¬¤é¡¤ .bashrc ¥Õ¥¡¥¤¥ë¤òÊÔ½¸¤·¡¤¥×¥í¥ó¥×¥È¤À¤±¤Ç¤âÊѹ¹¤·¤Æ¤ß¤è.
    warning.png .bashrc ¥Õ¥¡¥¤¥ë¤¬¤½¤â¤½¤â̵¤¤¾ì¹ç¤Ï¡¤¼¡¤Î¤è¤¦¤ËÀßÄꤷ¤Æ¤«¤éÊÔ½¸¤»¤è¡¥

    cd␣~

    touch␣.bashrc



  2. ;͵¤Î¤¢¤ë¼Ô¤Ï¤µ¤é¤Ë¡¤¥·¥§¥ë¤Î¥ª¥ó¥é¥¤¥ó¥Þ¥Ë¥å¥¢¥ë¤Ê¤É¤ò»²¹Í¤Ë¤·¤Æ¤¤¤í¤¤¤íÀßÄꤷ¤Æ¤ß¤è.

Alias: ¥¨¥¤¥ê¥¢¥¹ÀßÄê

¥¨¥¤¥ê¥¢¥¹(alias) ¤È¤Ï¡¤¥³¥Þ¥ó¥É¤Ë¡ÖÊÌ̾¡×¤ò¤Ä¤±¤ëµ¡Ç½¤Ç¤¢¤ë. (ÁǤΠsh ¤Ë¤Ï¤³¤Îµ¡Ç½¤Ï¤Ê¤¤¤¬)Ä̾ï¤Î¥·¥§¥ë¤Ë¤Ï¤¿¤¤¤Æ¤¤¤Ä¤¤¤Æ¤ª¤ê¡¤´Êñ¤Ê¤ï¤ê¤ËÊØÍø¤À¡¥

°Ê²¼¤ÎÎã¤Ï¤Ê¤ë¤Ù¤¯ bash ·Á¼°¤Ç½ñ¤¤¤Æ¤¢¤ë.

Gnome-Preferences.png alias ¤Î»ÈÍÑÎã:

¥¿¥¤¥Ô¥ó¥°¤Î¼ê´Ö¤ò¸º¤é¤·¡¤¥ß¥¹¤ò¾¯¤Ê¤¯¤¹¤ë
Îã) alias␣md='mkdir'
Îã) alias␣em='xemacs'

Ê£»¨¤ÊÆ°ºî¤ò 1¥³¥Þ¥ó¥É¤Ëû½Ì¤¹¤ë(¿·¤·¤¤¥³¥Þ¥ó¥É¤òºî¤ë)
Îã) alias␣newfile='touch␣dummy-`date␣+%m%d`'
Îã csh ·Ï¤Î¤ß) alias␣printfile␣'a2ps␣\!*␣|␣lpr'

¥³¥Þ¥ó¥É¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¤Ê¤É¤·¤Æ¡¤¥Ç¥Õ¥©¥ë¥ÈÆ°ºî¤òÊѹ¹¤¹¤ë
Îã) alias␣cp='cp␣-i'
Îã) alias␣mv='mv␣-i'
Îã) alias␣rm='rm␣-i'
Îã) alias␣man='jman'
Îã) alias␣ls='ls␣--color=auto␣-Fga'

ÊÑ¿ô¤òÀßÄꤹ¤ë
Îã) alias␣newpath='PATH=hogehoge'

Syntax for aliases: ¥¨¥¤¥ê¥¢¥¹¤òÍѤ¤¤ë¤¿¤á¤Îʸˡ

¥¨¥¤¥ê¥¢¥¹Ã±ÆȤǹͤ¨¤ë¤È¡¤°ú¿ô¤òÍѤ¤¤ë¤³¤È¤¬¤Ç¤­¤ë csh ·Ï¤Î¥·¥§¥ë¤ÎÊý¤¬ÊØÍø¤Ç¤¢¤ë¤¬¡¤ sh ·Ï¤Î¥·¥§¥ë¤Î¡Ö´Ø¿ô¡×¤È¤¤¤¦»ÅÁȤߤòÍѤ¤¤ì¤Ðµ¡Ç½Åª¤Ë¤Ï¤Û¤ÜƱ¤¸¤È¤¤¤Ã¤Æ¤è¤¤¤À¤í¤¦.

¤É¤Á¤é¤Ë¤»¤è¡¤¤­¤Á¤ó¤È¤·¤¿µ¡Ç½¤òÍߤ¹¤ë¤Î¤Ç¤¢¤ì¤Ð ¥·¥§¥ë¥¹¥¯¥ê¥×¥È¤òÁȤà¼ê´Ö¤È¤¢¤Þ¤êÊѤï¤é¤Ê¤¤¤·¡¤ ¤½¤¦¤Ê¤ì¤ÐÆäˤɤΥ·¥§¥ë¤¬¤è¤¤°­¤¤¤È¤¤¤¦¶èÊ̤Ϥʤ¤(csh ·Ï¥·¥§¥ë¤Ç¥·¥§¥ë¥¹¥¯¥ê¥×¥È¤òÁȤà¤Ù¤­¤Ç¤Ï¤Ê¤¤¡¤¤È¤¤¤¦Î®Çɤ⤤¤ë).

Syntax for aliases (sh): ¥¨¥¤¥ê¥¢¥¹Ê¸Ë¡: sh·Ï

ÀßÄê
alias␣ÊÌ̾='¥³¥Þ¥ó¥É'

¤¿¤À¤·¡¤°ú¿ô¤Ï»È¤¨¤Ê¤¤¡¥
(¤Þ¤¿¡¤ÁǤΠsh ¤Ë¤Ï¤³¤Îµ¡Ç½¤Ï¤Ê¤¤)

²ò½ü
unalias␣ÊÌ̾

ɽ¼¨
alias

´Ø¿ôÀßÄê
°ú¿ô¤ò¤È¤ëÂå¤ï¤ê¤Ë»È¤¦¡¥
¿·´Ø¿ô̾(){
ÆâÍÆ¡Ä ;
ÆâÍÆ¡Ä ;
}

n ÈÖÌܤΰú¿ô¤ò $n ¤È¤·¤Æ»²¾È¤Ç¤­¤ë.



Syntax for aliases (csh): ¥¨¥¤¥ê¥¢¥¹Ê¸Ë¡: csh·Ï

ÀßÄê
alias␣ÊÌ̾␣'¥³¥Þ¥ó¥É'
csh ·Ï¤Î¾ì¹ç¡¤°ú¿ô¤ò¼¡¤Î¤è¤¦¤Ë¤·¤Æ alias ¤Ë´Þ¤á¤ë¤³¤È¤¬¤Ç¤­¤ë.
°ÕÌ£µ­¹æ
Á´¤Æ¤Î°ú¿ô\!*
ºÇ¸å¤Î°ú¿ô\!$
nÈÖÌܤΰú¿ô\!:n


²ò½ü
unalias␣ÊÌ̾

ɽ¼¨
alias



notes.png ¼Â½¬

  1. ¾å¤Ë¼¨¤·¤¿ alias Îã¤ò»î¤·¤Æ¤ß¤Æ¡¤ÊØÍø¤½¤¦¤Ê¤â¤Î¤ò½é´üÀßÄꤻ¤è.

  2. (;͵¤¬¤¢¤ë¼ÔÍÑ) alias ¤Ê¤¤¤·¤Ï´Ø¿ôµ¡Ç½¤òÍѤ¤¤Æ¡¤ Æó°ú¿ô¤Î½çÈÖ¤òµÕ¤Ë¤·¤Æɽ¼¨¤¹¤ë¥³¥Þ¥ó¥É swap ¤òÍÑ°Õ¤»¤è.
    ¤Ä¤Þ¤ê¡¤ swap␣a␣b ¤ÈÆþÎϤ¹¤ë¤È¡¤ b␣a ¤Èɽ¼¨¤µ¤ì¤ë¤è¤¦¤Ê alias ¤â¤·¤¯¤Ï´Ø¿ô swap ¤ò¼Â¸½¤·¤Æ¤ß¤í¡¤¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë.

Configration of terminals: üËöÀßÄê

¾å¤Ë½Ð¤Æ¤­¤¿ TERM, TERMCAP ¤È¤¤¤Ã¤¿´Ä¶­ÊÑ¿ô¤ä¤½¤ì¤ËÎह¤ë¤â¤Î¤òÀßÄꤹ¤ë. bash ¤Ê¤é¤Ð .bash_profile ¥Õ¥¡¥¤¥ë¤Ç¡¤ csh ·Ï¥·¥§¥ë¤Ê¤é¤Ð .login ¥Õ¥¡¥¤¥ë¤Ç¹Ô¤Ê¤¦¤Î¤¬Îɤ¤¤À¤í¤¦.
warning.png ¸½¾õ¤Ç¤Ï¡¤Ä̾ï¥æ¡¼¥¶¤¬Ã¼ËöÀßÄê¤ò¹Ô¤Ê¤¦É¬Í×À­¤Ï¤¢¤Þ¤ê¤Ê¤¤¡¥ Êѹ¹¤·¤Æ¥È¥é¥Ö¥ë¤³¤È¤â¿¤¤¤Î¤Ç¡¤ ÆäËɬÍפ¬¤Ê¤±¤ì¤ÐüËöÀßÄê¤Ï¤·¤Ê¤¤Êý¤¬¤è¤¤.

¤¿¤À¤·¡¤¥­¡¼¥Ð¥¤¥ó¥Ç¥£¥ó¥°(¥­¡¼Áàºî)¤òÊѤ¨¤¿¤¤¤È¤¤¤¦¾ì¹ç¤À¤±¤Ï¡¤ bash ¤ä tcsh ¤Î¤è¤¦¤Ê¿·¤·¤á¤Î¥·¥§¥ë¤Ç¤Ï·ë¹½°ÂÁ´¤ÊÊýË¡¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¥ª¥¹¥¹¥á¤À. bash ¤Ç¤Ï .inputrc ¤È¤¤¤¦¥Õ¥¡¥¤¥ëÃæ¤Ë¤·¤«¤ë¤Ù¤­ÀßÄê¤ò¡¤ tcsh ¤Ç¤Ï bind ¥³¥Þ¥ó¥É¤ò»È¤Ã¤Æ .tcshrc ¥Õ¥¡¥¤¥ëÃæ¤Ç¤·¤«¤ë¤Ù¤­ÀßÄê¤ò¹Ô¤Ê¤¨¤Ð¤è¤¤. ¾Ü¤·¤¯¤Ï¥ª¥ó¥é¥¤¥ó¥Þ¥Ë¥å¥¢¥ë¤Ê¤É¤ÇÄ´¤Ù¤ë¤³¤È.



Commands launched on login: ¥Ç¥Õ¥©¥ë¥È¥³¥Þ¥ó¥Éµ¯Æ°

bash ¤Ê¤é¤Ð .bash_profile ¤Ç, csh ·Ï¤Ê¤é¤Ð .login ¤Ç¡¤¥í¥°¥¤¥ó»þ¤Ëµ¯Æ°¤µ¤ì¤ë¥³¥Þ¥ó¥É¤ò½ñ¤¤¤Æ¤ª¤¯¡¤ ¤È¤¤¤¦¤³¤È¤â¤Ç¤­¤ë.
¤³¤ì¤ò¤¦¤Þ¤¯»È¤Ã¤Æ¡¤Î㤨¤Ðµ¯Æ°»þ¤Ë

  1. ¥Ç¥£¥¹¥¯¤Î(¼«Ê¬¤Î)»ÈÍÑÎ̤òÄ´¤Ù¤ë.
  2. ¥á¡¼¥ë¤¬Íè¤Æ¤¤¤ë¤«Ä´¤Ù¤ë.
  3. º£Æü¤Î±¿Àª¤òÀꤦ(^-^).
  4. ¡û¡û¤µ¤ó¤¬Âç³Ø¤Î¥Þ¥·¥ó¤Ë¥í¥°¥¤¥ó¤·¤Æ¤¤¤ë¤«Ä´¤Ù¤ë.
  5. ¤ä¤é¤Ê¤¤¤È¤¤¤±¤Ê¤¤»Å»ö¤òɽ¼¨¤¹¤ë(ToT)

¤Ê¤É¤È¤¤¤¦¤³¤È¤¬¤Ç¤­¤ë(¤Þ¤¢¡¤º£Æü¤Ï¤½¤ó¤Ê¤Ë¤¢¤ê¤¬¤¿¤¯¤Ê¤¤¤¬).



notes.png ¼Â½¬

  1. ¥í¥°¥¤¥ó¤¹¤ë¤¿¤Ó¤Ë¡¤
    You use *** KB in this system.
    ¤È¤¤¤¦´¶¤¸¤Ç¥Ç¥£¥¹¥¯»ÈÍÑÎ̤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤»¤è.
    ¤Ê¤ª¡¤du ¤È¤¤¤¦¥³¥Þ¥ó¥É¤ò»È¤¦¤ÈÎɤ¤. ¤¿¤À¤·¡¤¥ª¥×¥·¥ç¥ó¤Ï¿µ½Å¤ËÀßÄꤷ¤è¤¦¡¥

Report: ¥ì¥Ý¡¼¥È

°Ê²¼¤Î²ÝÂê¤Ë¤Ä¤¤¤Æǽ¤¦¸Â¤ê¸­ÌÀ¤ÊÄ´ºº¤È¹Í»¡¤ò¹Ô¤¤¡¤
AppliedMath7-Report-04
¤È¤¤¤¦Âê̾¤ò¤Ä¤±¤Æ e-mail ¤Ë¤Æ¶µ´±°¸¤Ë¥ì¥Ý¡¼¥È¤È¤·¤ÆÄó½Ð¤»¤è. ¤Ê¤ª¡¤¥ì¥Ý¡¼¥È¤ò e-mail ¤ÎÂå¤ï¤ê¤Ë TeX ¤ÇºîÀ®¤·¤¿½ñÌ̤ˤÆÄó½Ð¤·¤Æ¤â¤è¤¤.

Exercises: ²ÝÂê

  1. ËÜ»ñÎÁ¤Î¼Â½¬Éôʬ¤ò¤¹¤Ù¤Æ¹Ô¤¤¡¤¤½¤ì¤Ë¤Ä¤¤¤Æ¡Ö¤­¤Á¤ó¤È¡×Êó¹ð¤»¤è(¤ä¤ê¤Þ¤·¤¿¡¤¤Ê¤É¤À¤±¤È¤¤¤¦¤Î¤Ï¥À¥á¤À¤è¤Í)¡¥
  2. ¥Ñ¥¤¥×¤ÈÁȤ߹ç¤ï¤»¤Æ¾å¼ê¤Ë»È¤¦¤ÈÊØÍø¤½¤¦¤Ê¥³¥Þ¥ó¥É¤ò¾Ò²ð¤»¤è¡¥
  3. ¥·¥§¥ë¤Î¥×¥í¥ó¥×¥ÈÀßÄê¤ò¡ÖÊØÍø¤Ë¤Ê¤ë¤è¤¦¤Ë¡×ÀßÄꤻ¤è¡¥
  4. ¡Öº£Æü¤ÎÆüµ­¤ò½ñ¤¯¤¿¤á¤Ë¥¨¥Ç¥£¥¿¤¬µ¯Æ°¤¹¤ë¡×¤È¤¤¤¦¥³¥Þ¥ó¥É¤òÍÑ°Õ¤»¤è.
    ¶ñÂÎŪ¤Ë¤Ï¡¤¤½¤ÎÆü¤ÎÆüÉÕ¤¬¤Ä¤¤¤¿¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë¤ò¥¨¥Ç¥£¥¿¤¬³«¤¯¡¤ ¤È¸À¤¦ÄøÅ٤Ǥ褤.

about Icons, ClipArts

For details, see JNorth_arrow-right-sm.png this.


*1 ¤Ê¤¼¤«¤ÏÃΤé¤Ê¤¤¤¬¡¤Â¿¤¯¤Î²òÀâ½ñÅù¤Ç¤Ï¤³¤Î Here-Document µ¡Ç½¤Ë¿¨¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤¬Â¿¤¤

źÉÕ¥Õ¥¡¥¤¥ë: filestdinout.png 716·ï [¾ÜºÙ]