Notepad ++ execution error when writing shell statement, notepadshell

Source: Internet
Author: User

Notepad ++ execution error when writing shell statement, notepadshell

I think the vi format scheduling is not very good. I used notepad ++.

During a shell statement debugging, it was found that there were no errors when the shell copied from notepad ++ was executed in Linux! However, when you upload the shell script written by notepad to Linux for debugging, an error indicating that the command cannot be found is reported! Think about it. The root cause of the problem must be Nodepad ++. Then, find the cause,It turns out to be a format conversion problem.

Temporary solution:


Permanent solution:

Open in notepad ++, set, preference



How to read variable values in case statements in shell scripts? I wrote a script and reported an error after running it.

Read CHOICE
Case $ CHOICE in
1) mountusb ;;
2) umountusb ;;
3) display ;;
4) cpdisktousb ;;
5) cpusbtodisk ;;
0) quit ;;
*) Echo "Invalid Choice! Correct Choice is (0--5 )"
Sleep 4 clear ;;

The logic of the if statement in shell is incorrect.

Use the $ symbol to get the variable value (add $ before the variable ).

Test = 1
If [$ test-eq 1]; then
Echo "test = 1"
Elif [$ test-eq 0]; then
Echo "test = 0"
Else
Echo "other"
Fi
------------------------------
Supplement: test is a shell built-in command used to test the expression. The variable name you define is exactly the same.
Your script will report a syntax error here: [: test: integer expression expected
It may also be related to what shell you are using.

Replace it with count, and I am also prompted with a syntax error, [: count: integer expression expected
Because-eq is used for integer comparison, the script expects that both sides of this operator are integer or integer expressions.

But I did report an error on this side, that is, the execution is not allowed. Please use Baidu hi to facilitate communication.

Related Article

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.