Bash for loop error -


I am using a simple Bash script for loop, and I keep the following error: < Pre> '/ test.sh: line 2: Syntax error near the unexpected token' do '/test.sh: Line 2: `Do

Use the following code Eating for dog in dog cat elephant "There are $ {animals}" ....

However, when I tried it on other machines. It does not make any problems. Is obtained. Please help.

Your test.sh script has Windows-style line end in Shell Line At the end of each, the \ r \ n sees the sequence as a \ r character.

Seeing the shell instead of \ r instead of . Since \ r sends the cursor to the beginning of the line, so try to see the quotation marks at the beginning of the line

./ test.sh 2> & Amp; 1 | Cat-A

To see what exactly is in the error message

To fix your capacitance, filter your test.sh script through something like dos2unix . (Be sure to read the man page first; dos2unix , unlike most text filters, overwrites its input file.)

This is a common problem on signin. Have you used a Windows Editor to create scripts?

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -