I have a *.sh script that's missing the shebang from the first line. Can I fix it with sed?
Sed Usage: Add shebang missing from first line of script
bash;shell;command line;sed;text
Insert (i) the shebang with sed, in place operation:sed -i '1 i #!/bin/bash' file.shWith backing up the original file with a .bak extension:sed -i.bak '1 i #!/bin/bash' file.shReplace #!/bin/bash with actual shebang you want.Example:% cat foo.shecho foobar% sed '1 i #!/bin/bash' foo.sh #!/bin/bashecho foobar