I recently started to learn the LinuxShell language and read the Private food of laruence. For the "Basic Linux Private food Learning for laruence (Third edition) PDF High Definition", see http://www.linuxidc.net/thread-2268-1-1.html. There are two methods to execute the shell script: 1. Set the execution attribute: chmod755file for execution (if it is already in the current directory ):.
I recently started to learn the Linux Shell language.
Look at the birds brother private dish, "Bird brother Linux private dish basic learning (the third edition) PDF High Definition" Download see http://www.linuxidc.net/thread-2268-1-1.html. There are two methods to execute shell scripts:
1. Set the execution attribute: chmod 755 file
Run (if it is already in the current directory):./file
2. Run the command using sh file.
However, Ubuntu 11.10 installed in vmware cannot be executed.
- #! /Bin/bash
- Declare-I s
- For (I = 1; I <= 100; I = I + 1 ))
- Do
- S = s + I
- Done
- Echo "The count is ==> $ s"
When the second method is used for execution, the following occurs:
Test04_for.sh: 1: declare: not found
Test04_for.sh: 3: Syntax error: Bad for loop variable
Solution:
Enter:
Sudo dpkg-reconfigure dash
Select "NO" on the displayed page.
Then you can run it correctly.
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2