[Solution] ") syntax error: Invalid Arithmetic Operator (error token is"

Source: Internet
Author: User

Http://blog.sciencenet.cn/blog-588243-502678.html? Collcc = 132586598 &

Your error message seems to indicate pollution of your data with CRS.

") Syntax error: Invalid Arithmetic Operator (error token is"

Notice how the stuff that's supposed to come after the current end of your line is at the beginning. that's most likely because your error token is in fact a Cr (which is a carriage return character-a character that instructs the terminal to put the cursor
On the beginning of the Line). These characters are almost only used by Windows machines where they are part of line endings.

I will assume that you're working on a Windows machine and that your "date" command gave the output followed by a "Windows" newline, which is actually a \ r \ n (carriage return, newline ). the $ () always strips trailing newlines, which leaves the \ r at the end
Causing parsing problems in your script.

Here, the following command produces your error on UNIX:

$ Foo = $'5 \ R'; echo
$(5 + Foo ))
") Syntax error: Invalid Arithmetic Operator (error token
Is"

To resolve the issue, you need to get rid of the \ r in your data. You can use parameter expansion for this, or tr (1 ).

$ Foo = $'5 \ R'; echo
$(5 + $ {Foo // $ '\ R '}))
10

Foo = $'5 \ R'; echo
$(5 + $ (tr-d' \ R' <"$ foo ")))
10

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.