linuxÔõôÔËÐÐshell¾ç±¾
ÔÚ linux ÖÐÔËÐÐ shell ¾ç±¾ÓÐÁ½ÖÖÒªÁ죺ʹÓþ籾ڹÊÍÆ÷£ºsh »ò bashʹÓÿÉÖ´ÐÐ루chmod +x£©£ºµ¼º½µ½¾ç±¾Ä¿Â¼²¢ÔËÐÐ ./script.sh
ÔÚ Linux ÖÐÔËÐÐ Shell ¾ç±¾
ÔËÐÐ shell ¾ç±¾ÊÇ Linux ÖÐÒ»Ïî»ù±¾µÄÖÎÀíʹÃü¡£Shell ¾ç±¾ÊÇ°üÀ¨ÏÂÁîµÄÎı¾Îļþ£¬µ±Ö´ÐÐʱ£¬ÕâЩÏÂÁ°´Ë³ÐòÖ´ÐС£
ÔõÑùÔËÐÐ Shell ¾ç±¾
ÔÚ Linux ÖУ¬ÓÐÁ½ÖÖÖ÷ÒªÒªÁì¿ÉÒÔÔËÐÐ shell ¾ç±¾£º
ʹÓþ籾ڹÊÍÆ÷£º
sh script.sh bash script.sh
µÇ¼ºó¸´ÖÆ
ʹÓÿÉÖ´ÐÐλ£º
chmod +x script.sh ./script.sh
µÇ¼ºó¸´ÖÆ
Ïêϸ°ì·¨
ʹÓþ籾ڹÊÍÆ÷£º
·¿ªÖնˡ£
ÊäÈëÒÔÏÂÏÂÁÓÃÄãµÄ¾ç±¾Ãû³ÆÌæ»» script.sh£©£º
sh script.sh
µÇ¼ºó¸´ÖÆ
ʹÓÿÉÖ´ÐÐλ£º
·¿ªÖնˡ£
µ¼º½µ½°üÀ¨¾ç±¾ÎļþµÄĿ¼¡£
ʹÓÃÒÔÏÂÏÂÁîʹ¾ç±¾¿ÉÖ´ÐУ¨ÓÃÄãµÄ¾ç±¾Ãû³ÆÌæ»» script.sh£©£º
chmod +x script.sh
µÇ¼ºó¸´ÖÆ
ÔËÐо籾£º
./script.sh
µÇ¼ºó¸´ÖÆ
Ã÷È·Ñ¡Ïî
sh ºÍ bash Êdz£¼ûµÄ shell Ú¹ÊÍÆ÷¡£
+x ½«¿ÉÖ´ÐÐȨÏÞÌí¼Óµ½¾ç±¾¡£
./ ÌåÏÖÄ¿½ñĿ¼£¬ËüÐèÒªÔÚͨ¹ý¿ÉÖ´ÐÐλÔËÐо籾ʱʹÓá£
ÆäËû×¢ÖØÊÂÏî
È·±£¾ç±¾¾ßÓÐÊʵ±µÄȨÏÞ¡£
ÑéÖ¤¾ç±¾ÄÚÈÝÊÇ·ñ׼ȷ¡£
ʹÓÃÊʵ±µÄ²ÎÊýÔËÐо籾£¬ÈôÊÇÐèÒª¡£
¾ç±¾ÖеıäÁ¿ºÍº¯Êý¿ÉÒÔÓ°ÏìÖ´ÐÐЧ¹û¡£
ÒÔÉϾÍÊÇlinuxÔõôÔËÐÐshell¾ç±¾µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡