Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在所有扩展名为脚本#!/bin/bash的文件中编辑文件顶部的 she bang line 行。.sh
#!/bin/bash
.sh
您可以使用 sed 命令执行此操作:
sed -i "1i #!/bin/bash" *.sh
sed
-i
1
i
*.sh
find /path -iname "*.sh" -type f -exec sed -i.bak '1i #!/bin/bash' "{}" +;