Linux BashrcÊÇʲô£¿Ïêϸ½â¶Á
Linux BashrcÊÇLinuxϵͳÖеÄÒ»¸öÉèÖÃÎļþ£¬ÓÃÓÚÉèÖÃÓû§µÄBash£¨Bourne Again Shell£©ÇéÐΡ£BashrcÎļþ´æ´¢ÁËÓû§µÇ¼ʱËùÐèµÄÇéÐαäÁ¿¡¢Æô¶¯¾ç±¾µÈÐÅÏ¢£¬¿ÉÒÔ¶¨ÖÆ»¯Óû§µÄShellÇéÐΡ£ÔÚLinuxϵͳÖУ¬Ã¿¸öÓû§¶¼ÓÐÒ»¸ö¶ÔÓ¦µÄBashrcÎļþ£¬Î»ÓÚÓû§µÄ¼ÒĿ¼ÏµÄÒþ²ØÎļþ¼ÐÖС£
BashrcÎļþµÄ×÷ÓÃÖ÷ÒªÓÐÒÔϼ¸µã£º
ÉèÖÃÇéÐαäÁ¿£º¿ÉÒÔÔÚBashrcÎļþÖÐÉèÖÃÖÖÖÖÇéÐαäÁ¿£¬ÈçPATH£¨ÏÂÁîËÑË÷·¾¶£©¡¢EDITOR£¨Ä¬Èϱà¼Æ÷£©¡¢PS1£¨ÌáÐÑ·û£©¡¢µÈµÈ¡£ÕâЩ±äÁ¿¿ÉÒÔÔÚÓû§µÇ¼ʱ×Ô¶¯¼ÓÔØ£¬Àû±ãÓû§Ê¹Óá£
¶¨ÖÆShellÐÐΪ£º¿ÉÒÔÔÚBashrcÎļþÖнç˵һЩShellº¯Êý»òÓÖÃû£¬ÒÔ±ãÓû§ÔÚShellÖÐŲÓá£ÕâÑù¿ÉÒÔ¼ò»¯ÏÂÁîÊäÈ룬Ìá¸ßÓû§µÄÊÂÇéЧÂÊ¡£
ÉèÖÃShellµÄÆô¶¯¾ç±¾£º¿ÉÒÔÔÚBashrcÎļþÖбàдһЩ¾ç±¾£¬ÔÚÓû§µÇ¼ʱ×Ô¶¯Ö´ÐУ¬ÒÔÍê³ÉһЩ³õʼ»¯µÄ²Ù×÷£¬ÈçÉèÖÃĬÈϱà¼Æ÷¡¢ÏÔʾϵͳÐÅÏ¢µÈ¡£
ÏÂÃæÊÇÒ»¸öÏêϸµÄBashrcÉèÖÃÎļþʾÀý£¬ÒÔ¸üºÃµØÃ÷È·Æä½á¹¹ºÍÓ÷¨£º
# BashrcÉèÖÃÎļþʾÀý # ÉèÖÃÇéÐαäÁ¿ export PATH=$PATH:/usr/local/bin:/opt/bin export EDITOR=vim export PS1='u@h:w$ ' # ÉèÖÃÓÖÃû alias ll='ls -alF' # ½ç˵Shellº¯Êý myfunc() { echo "This is a custom function" } # Ö´Ðгõʼ»¯¾ç±¾ if [ -f ~/my_init_script.sh ]; then source ~/my_init_script.sh fi # ¸ü¶à×Ô½ç˵ÉèÖÃ...
µÇ¼ºó¸´ÖÆ
ÔÚÉÏÃæµÄʾÀýÖУ¬Ê×ÏÈͨ¹ýexportÏÂÁîÉèÖÃÁËPATH¡¢EDITORºÍPS1µÈÇéÐαäÁ¿£¬È»ºóͨ¹ýaliasÏÂÁîÉèÖÃÁËllÓÖÃû£¬½Ó׎ç˵ÁËÒ»¸öÃûΪmyfuncµÄShellº¯Êý¡£×îºó£¬Í¨¹ýifÌõ¼þÓï¾ä¼ì²éÊÇ·ñ±£´æmy_init_script.sh¾ç±¾Îļþ£¬²¢ÔÚ±£´æʱִÐиþ籾¡£
×ܵÄÀ´Ëµ£¬BashrcÎļþÔÊÐíÓû§ÔڵǼShellʱ¶ÔÇéÐξÙÐÐ×Ô½ç˵ÉèÖúͳõʼ»¯£¬×ÊÖúÓû§¸ü¸ßЧµØʹÓÃLinuxϵͳ¡£Í¨¹ý¶ÔBashrcÎļþ¾ÙÐкÏÀíÉèÖúͶ¨ÖÆ£¬Óû§¿ÉÒÔƾ֤×Ô¼ºµÄÐèÇóÀ´ÉèÖÃShellµÄÇéÐκÍÐÐΪ£¬Ìá¸ßÊÂÇéЧÂʺÍʹÓÃÌåÑé¡£
ÒÔÉϾÍÊÇLinux BashrcÊÇʲô£¿Ïêϸ½â¶ÁµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡