025_自动为其他脚本添加解释器信息#!/bin/bash

#!/bin/bash
#先使用 grep 判断对象脚本是否已经有解释器信息,如果没有则使用 sed 添加解释器以及描述信息
if ! grep -q "^#!" $1; then #带参数
   sed -i '1i #!/bin/bash' $1
fi

原文地址:https://www.cnblogs.com/luwei0915/p/10515077.html