ºÇ½ª¹¹¿·¡§ engineernochiebukuro 2009ǯ04·î05Æü(Æü) 00:51:56ÍúÎò
¥·¥§¥ëÊÑ¿ô (shell variable) ¡§ ¸½ºßÍøÍѤ·¤Æ¤¤¤ë¥·¥§¥ëÆâ¤Ç¤·¤«Í¸ú¤Ç¤Ê¤¤ÊÑ¿ô¡£Â¾¤Î¥×¥í¥»¥¹¤Ë¤ÏÅÁ¤ï¤é¤Ê¤¤¡£Ä̾ï¤Ï¾®Ê¸»ú¤Ç½ñ¤¯¡£
´Ä¶ÊÑ¿ô (environment variable) ¡§ »Ò¥·¥§¥ë¤Ë¤â¡¢¤½¤ÎÊÑ¿ô¤ÎÆâÍƤò°ú¤·Ñ¤°¤³¤È¤¬¤Ç¤¤ëÊÑ¿ô¡£Ä̾Âçʸ»ú¤Ç½ñ¤¯¡£
Ä̾´·Îã¤È¤·¤Æ´Ä¶ÊÑ¿ô¤ÏÂçʸ»ú¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¤«¤éÊÑ¿ô̾¤ò»ÈÍѤ·¡¢¥·¥§¥ëÊÑ¿ô¤Ï¾®Ê¸»ú¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¤«¤é¤Ê¤ëʸ»úÎó¤ò»ÈÍѤ¹¤ë¡£¤·¤«¤·¡¢µ¡Ç½Åª¤Ë¤Ï¤É¤Á¤é¤ÎÊÑ¿ô¤Ë¤É¤Á¤é¤ò»ÈÍѤ·¤Æ¤â¹½¤ï¤Ê¤¤¡£¤Þ¤¿¡¢¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È°Ê³°¤Ë _ ¤òÊÑ¿ô̾¤Ë»È¤¦¤³¤È¤¬¤Ç¤¤ë¡£
C ¥·¥§¥ë¤Î¾ì¹ç¡¢¥·¥§¥ëÊÑ¿ô¤È´Ä¶ÊÑ¿ô¤¬ÆÃÊ̤ËÂбþ¤·¤Æ¤¤¤ë¤â¤Î¤¬¤¢¤ë¡£
Î㤨¤Ð¡¢¥·¥§¥ëÊÑ¿ô path ¤òÊѹ¹¤¹¤ë¤È´Ä¶ÊÑ¿ô PATH ¤ÎÆâÍƤâÊѹ¹¤µ¤ì¤ë¡£¤½¤Î¾¡¢user,term,home ¤âƱÍÍ¡£
¥·¥§¥ëÊÑ¿ô¤ò¤¹¤Ù¤Æɽ¼¨¤¹¤ë
$ set
»ØÄꤷ¤¿¥·¥§¥ëÊÑ¿ô¤òɽ¼¨¤¹¤ë
$ echo $<¥·¥§¥ëÊÑ¿ô̾>
$ PATH=/usr/local/bin:/opt/sfw/bin:$PATH $ export PATH¢¨¥·¥§¥ëÊÑ¿ô PATH ¤òÀßÄꤷ¡¢export ¥³¥Þ¥ó¥É¤Ç´Ä¶ÊÑ¿ô PATH ¤È¤·¤ÆºÆÄêµÁ¤¹¤ë¡£
$ set path=(/usr/local/bin /opt/sfw/bin $path)¢¨ csh ¤Î¾ì¹ç¡¤¥·¥§¥ëÊÑ¿ô path ¤òÊѹ¹¤¹¤ë¤È´Ä¶ÊÑ¿ô PATH ¤âϢư¤·¤ÆÊѹ¹¤µ¤ì¤ë¡£
/etc/profile ¢ ¡~/.bash_profile ¢~/.bash_login £~/.profile ¢¨¡¢£¤Î½ç½ø¤ÇºÇ½é¤Ë¸¡º÷¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤¬¼Â¹Ô¤µ¤ì¤ë¡£ ¢ ~/.bashrc
/etc/.cshrc ¢ /etc/.login ¢ ¡~/.tcshrc ¢~/.cshrc ¢¨¡¢¤Î½ç½ø¤ÇºÇ½é¤Ë¸¡º÷¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤¬¼Â¹Ô¤µ¤ì¤ë¡£ ¢ ~/.login ¢ ~/.cshdirs
SMC ¤Ç¥æ¡¼¥¶¤òºîÀ®¤¹¤ë¾ì¹ç¤È useradd ¥³¥Þ¥ó¥É¤Ç¥æ¡¼¥¶¤òºîÀ®¤¹¤ë¾ì¹ç¤Ç°Û¤Ê¤ë¡£
/etc/skel ¥Ç¥£¥ì¥¯¥È¥ê²¼¤Î
local.profile
local.cshrc
local.login
¤Î 3 ¤Ä¤Î¥Õ¥¡¥¤¥ë¤¬¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤Ë
.profile
.cshrc
.login
¤È¤·¤Æ¥³¥Ô¡¼¤µ¤ì¤ë¡£
/etc/skel ¥Ç¥£¥ì¥¯¥È¥ê²¼¤Î¤¹¤Ù¤Æ¤Î¥Õ¥¡¥¤¥ë¤¬¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤Ë¥³¥Ô¡¼¤µ¤ì¤ë¡£
local.* ¥Õ¥¡¥¤¥ë¤¬ .* ¥Õ¥¡¥¤¥ë¤Ë¥ê¥Í¡¼¥à¤µ¤ì¤Æ¥³¥Ô¡¼¤µ¤ì¤ë¤³¤È¤Ï¤Ê¤¤¡£
¤è¤Ã¤Æͽ¤á¡¢/etc/skel ²¼¤Î local.* ¥Õ¥¡¥¤¥ë¤ò .* ¥Õ¥¡¥¤¥ë¤Ë¥³¥Ô¡¼¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ë¡£
.profile ¤Ê¤É¤Î¥æ¡¼¥¶´Ä¶ÀßÄê¥Õ¥¡¥¤¥ë¤òÊѹ¹¤·¤¿¾ì¹ç¤Ï¡¢Í¸ú¤Ë¤¹¤ëÁàºî¤¬É¬Íס£
- ¥«¥Æ¥´¥ê¡§
- ¥¤¥ó¥¿¡¼¥Í¥Ã¥È
- Solaris
¤³¤Î¥Ú¡¼¥¸¤Ø¤Î¥³¥á¥ó¥È
Vnd7QW I loved your blog post.
ELOQ6X Im grateful for the blog post.