1

I can run below codes line by line using terminal without problem but when I run the script file I got

line 14: unexpected EOF while looking for matching `"'
line 30: syntax error: unexpected end of file

the script file is:

# this script produces edited rinex files from uncompressed rinex files
echo "NECESSARY FILES ARE UNCOMPRESED OBSERVATION (.o) FILES

# example: rnxEditGde.py -d amc20130.18d.Z -rate 30 -out amc2.gz

shopt -s nullglob
shopt -s failglob

i=$(find . -maxdepth 1 -type f -name '*[0-9][0-9]o' -printf 'x' | wc -c)
grep "MARKER NAME" *.[0-9][0-9]o > grep_file
awk -F'[: ]' '{print $1}' grep_file > station_ids

function pl {                
  sed -n "$1p" $2
}

for (( j=1; j <= i; j++ ))
do
ids=$(pl $j station_ids)

rnxEditGde.py -d $ids -rate 30 -out $ids.gz

done

closed as off-topic by karel, heemayl, N0rbert, terdon Jan 7 at 9:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This describes a problem that can't be reproduced, that seemingly went away on its own or was only relevant to a very specific period of time. It's off-topic as it's unlikely to help future readers." – karel, heemayl, N0rbert, terdon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Look at line 2: no ending " in echo. – heemayl Jan 7 at 7:54
1

Use https://www.shellcheck.net/ , it will help you find the issues with the script:

$ shellcheck myscript

Line 2:
echo "NECESSARY FILES ARE UNCOMPRESED OBSERVATION (.o) FILES
^-- SC1009: The mentioned syntax error was in this simple command.
     ^-- SC1078: Did you forget to close this double quoted string?

Line 10:
grep "MARKER NAME" *.[0-9][0-9]o > grep_file
     ^-- SC1079: This is actually an end quote, but due to next char it looks suspect.
                 ^-- SC1078: Did you forget to close this double quoted string?

Line 14:
  sed -n "$1p" $2
         ^-- SC1079: This is actually an end quote, but due to next char it looks suspect.
             ^-- SC1073: Couldn't parse this double quoted string. Fix to allow more checks.

Line 24:

^-- SC1072: Expected end of double quoted string. Fix any mentioned problems and try again.

So you should quote the argument to echo in line 2

0

echo "NECESSARY FILES ARE UNCOMPRESED OBSERVATION (.o) FILES

This line should end up with "(every opening double quotes require closing double quote)

echo "NECESSARY FILES ARE UNCOMPRESED OBSERVATION (.o) FILES"

Not the answer you're looking for? Browse other questions tagged or ask your own question.