0

I'm trying to insert a line of text beginning with a hash in a text file using a shell script, using something like this:

ex run <<EOEX
:i
#!/bin/bash
#SBATCH
.
:x
EOEX

But I want it to actually insert those lines beginning with the hash, and not treat them as comments. Thanks!

agc
  • 7,973
  • 2
  • 29
  • 50
Joseph Harvey
  • 83
  • 1
  • 5
  • 1
    Yes, that's what your code does. Is there a problem/question? ([Live demo](https://tio.run/##S0oszvj/P7VCoag0T8HGxtXfNYLLKpNLWVE/KTNPPwkoy6Uc7OQY4uzBpcdlVcEFVsCVmpyRr6CkDtSjrpCcn1eSmJlXbKXElZxYAjLn/38A).) – melpomene Jun 14 '19 at 15:49
  • 1
    When I test your script it inserts the comment lines. If it does something else for you, show the contents of `run` before and after running your script. – Bodo Jun 14 '19 at 15:50

0 Answers0