|
發表於 2009-1-11 23:08:22
|
顯示全部樓層
作業5問題
老師您好:
我在寫作業時參考了你的解法
但是在寫題時,
他出現了下列的錯誤訊息:
please input the cash:9090
./hw5.sh: line 7: a1: command not found
./hw5.sh: line 8: t: command not found
./hw5.sh: line 10: a2: command not found
./hw5.sh: line 11: t: command not found
./hw5.sh: line 13: a3: command not found
./hw5.sh: line 14: t: command not found
./hw5.sh: line 16: a4: command not found
./hw5.sh: line 17: t: command not found
./hw5.sh: line 19: a5: command not found
./hw5.sh: line 20: t: command not found
./hw5.sh: line 22: a6: command not found
./hw5.sh: line 23: t: command not found
./hw5.sh: line 25: a7: command not found
./hw5.sh: line 26: t: command not found
./hw5.sh: line 28: a8: command not found
./hw5.sh: line 29: t: command not found
./hw5.sh: line 31: a9: command not found
./hw5.sh: line 32: t: command not found
2000: , 1000: , 500: , 200: , 100: , 50:, 10: , 5: , 1:
也檢查了權限的設定:
-rwxrwxr-x 1 apple apple 479 Jan 12 06:52 hw5.sh
程式碼:
1 #!/bin/bash
2
3
4 echo -ne "\tplease input the cash:"
5 read money
6
7 a1 = $[ money / 2000 ]
8 t = $[ money % 2000 ]
9
10 a2 = $[ t / 1000 ]
11 t = $[ t % 1000 ]
12
13 a3 = $[ t / 500 ]
14 t = $[ t % 500 ]
15
16 a4 = $[ t / 200 ]
17 t = $[ t % 200 ]
18
19 a5 = $[ t / 100 ]
20 t = $[ t % 100 ]
21
22 a6 = $[ t / 50 ]
23 t = $[ t % 50 ]
24
25 a7 = $[ t / 10 ]
26 t = $[ t % 10 ]
27
28 a8 = $[ t / 5 ]
29 t = $[ t % 5 ]
30
31 a9 = $[ t / 1 ]
32 t = $[ t % 1 ]
33
34 echo -e "2000: $a1, 1000: $a2, 500: $a3, 200: $a4, 100: $a5, 50a6, 10: $a7, 5: $a8, 1: $a9"
是我的主機設定出了什麼問題嗎?? |
|