linuxÖеÄlcdÊÇʲôÒâ˼
ÔÚlinuxÖУ¬”lcd”ÊÇ”local change directory”µÄËõд£¬ÒâΪÍâµØ±ä»»Ä¿Â¼£¬ËüÊÇÒ»¸öÏÂÁ³£ÓÃÓÚshell¾ç±¾ÖУ¬ÔÚÄ¿½ñÊÂÇéĿ¼ÖоÙÐÐĿ¼Çл»£¬Í¨¹ýʹÓÔlcd”ÏÂÁ¿ÉÒÔÔÚshell¾ç±¾ÖиüÎÞаµØ´¦ÀíĿ¼Çл»£¬Ê¹µÃ¾ç±¾Ö´ÐÐʱ´ú¿ÉÒÔÔÚ²î±ðµÄĿ¼ÖоÙÐвÙ×÷£¬¶ø²»»áÓ°Ïìµ½¾ç±¾Ö´Ðп¢ÊºóµÄÇéÐΡ£
±¾½Ì³Ì²Ù×÷ϵͳ£ºLinux5.18.14ϵͳ¡¢Dell G3µçÄÔ¡£
ÔÚLinuxÖУ¬”lcd”ÊÇÖ¸”Local Change Directory”µÄËõд£¬ÒâΪÍâµØ±ä»»Ä¿Â¼¡£ËüÊÇÒ»¸öÏÂÁ³£ÓÃÓÚshell¾ç±¾ÖУ¬ÔÚÄ¿½ñÊÂÇéĿ¼ÖоÙÐÐĿ¼Çл»¡£
µ±ÔÚshell¾ç±¾ÖÐʹÓÔlcd”ÏÂÁîʱ£¬Ëü»á½«Ä¿½ñÊÂÇéĿ¼Çл»µ½Ö¸¶¨µÄĿ¼¡£ÕâÓë”cd”ÏÂÁîÀàËÆ£¬µ«”lcd”Ö»»áÔÚÄ¿½ñshell¾ç±¾ÖÐÉúЧ£¬²»»áÓ°Ïìµ½¸¸Àú³Ì»òÆäËûÀú³Ì¡£
Ò»Ñùƽ³£À´Ëµ£¬”lcd”ÏÂÁîÓÃÓÚÔÝʱ¸Ä±äÄ¿½ñÊÂÇéĿ¼£¬¶ø²»Ó°Ïì¾ç±¾Ö®ÍâµÄÆäËû²Ù×÷¡£ÀýÈ磬ÔÚÒ»¸öshell¾ç±¾ÖУ¬¿ÉÄÜÐèÒªÔÚ²î±ðµÄĿ¼ÖÐÖ´ÐÐһϵÁвÙ×÷£¬¶øÓÖ²»Ïë¸Ä±äÕû¸öshellÇéÐεÄÄ¿½ñĿ¼£¬ÄÇô¿ÉÒÔʹÓÔlcd”ÏÂÁî¾ÙÐоֲ¿Çл»¡£
ÏÂÃæÊÇÒ»¸öʾÀý£¬ÑÝʾÁËÔõÑùÔÚshell¾ç±¾ÖÐʹÓÔlcd”ÏÂÁ
#!/bin/bash echo "Ä¿½ñÊÂÇéĿ¼ÊÇ£º$PWD" lcd /path/to/some/directory echo "Çл»ºóµÄÊÂÇéĿ¼ÊÇ£º$PWD" # ÆäËû²Ù×÷... lcd /another/directory echo "Çл»ºóµÄÊÂÇéĿ¼ÊÇ£º$PWD" # ÆäËû²Ù×÷...
µÇ¼ºó¸´ÖÆ
ͨ¹ýʹÓÔlcd”ÏÂÁ¿ÉÒÔÔÚshell¾ç±¾ÖиüÎÞаµØ´¦ÀíĿ¼Çл»£¬Ê¹µÃ¾ç±¾Ö´ÐÐʱ´ú¿ÉÒÔÔÚ²î±ðµÄĿ¼ÖоÙÐвÙ×÷£¬¶ø²»»áÓ°Ïìµ½¾ç±¾Ö´Ðп¢ÊºóµÄÇéÐΡ£
ÒÔÉϾÍÊÇlinuxÖеÄlcdÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡