0

I am modifying the input and bash files of a model that I run using Cygwin. I have no problems when modifying the input files using readLines() and write(). However, for the bash file I get the following error in Cygwin: "Line xx: syntax error, unexpected end of file". The xxx is the final line of the file. Is there a way to open, modify and save these type of files withtout producing any change in the format or does anybody know how to solve this?

Thanks!

G

I have modified other files of the same program (inputs and data) files and saved back using write() in R and the program has run ok. It is just modifying the bash file when I get the error.

  • It looks like you get a syntax error. Having you verify what you have modified and maybe check the syntax afterwards (e.g. with shellcheck)? – jimmymcheung Apr 20 '23 at 13:09
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. It sounds like the error comes from invalid syntax in the file like a missing closing quote or parenthesis. Really hard to say without seeing any code at all – MrFlick Apr 20 '23 at 13:10
  • Please provide enough code so others can better understand or reproduce the problem. – Community Apr 20 '23 at 14:18
  • Hi all, thanks for your comments. After a few tests, I started to open and save using write() the bash file and still I receive the same error. Therefore, I assume is not due to the modifications but due to a format modification when I open and save in RStudio. Essentially, when I open and write (without modifications) a bash file that I normally run with Cygwin I receive a the syntax error message. Thanks. – user7369441 Apr 24 '23 at 07:03

0 Answers0