Error 1: [: too many arguments

Problem causes:

if [ $i = "This is my script" ]

if your variable $i equals the string "This is my script", bash will not recognize it because the space can be recognized and bash will think there is more than one variables here.

[ This is my script = "This is my script" ]

Solution:

Add double quotes to variable $i.

if [ "$i" = "This is my script" ]


Error 2: unexpected EOF while looking for matching ''' & syntax error: unexpected end of file

Problem causes:

There is an extra apostrophe(') in a line in your code.

solution:

Check your code and delete the extra apostrophe(').

Last modified: 2020年3月30日

Comments

Write a Reply or Comment

Your email address will not be published.