在SHELL下写的脚如何运行(转)

在SHELL下写的脚本如何运行?

和其他可执行文件一样 
  
  注意几点 
  
  1.文件开头的#!格式说明一定要有 
  2.文件要有可执行权限x 
  3.运行时列出正确路径,例如,当前目录用./ 
  shell的执行流程如下: 
  
  1。vi   prog_name   //就是用vi来写你的脚本。 
  
  2。保存后,在shell下,输入chmod   711   prog_name,回车。 
  
  3。运行,在shell下,输入prog_name,如果不行,输入./prog_name。 
  
  4。观察结果。    

$chmod   a+x   filename.sh 
  $./filename.sh

原文地址:https://www.cnblogs.com/zhihaowang/p/10128754.html