VIM环境有一占问题
Tofloor
poster avatar
bhmeili
deepin
2019-05-16 05:55
Author
同样语句:
for (( i=1;i<10;i++ ))   


Syntax error: Bad for loop variable


在深度系统上报错,在centos上就可以,不懂为什么?

Reply Favorite View the author
All Replies
avatar
189******23
deepin
2019-05-16 07:08
#1
patrick@patrick-PC:~$ cat test.sh
for (( i=1;i<10;i++ ))
do
echo $i
done
patrick@patrick-PC:~$ bash test.sh
1
2
3
4
5
6
7
8
9
patrick@patrick-PC:~$

请使用bash
在脚本第一行加上#!/bin/bash
Reply View the author
avatar
bhmeili
deepin
2019-05-17 06:50
#2
https://bbs.deepin.org/post/178071
patrick@patrick-PC:~$ cat test.sh
for (( i=1;i

加了的,就是在用shell写程序,我看一下,昨天死活不得,谢谢
Reply View the author
avatar
189******23
deepin
2019-05-18 19:22
#3
https://bbs.deepin.org/post/178071
加了的,就是在用shell写程序,我看一下,昨天死活不得,谢谢

bash不是sh.
Reply View the author
avatar
魔法师
deepin
2019-05-18 20:45
#4
  1. for i in `seq 6`; do echo $i; done
  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. 6
  8. for i in `seq 6`
  9. do:开始
  10.     执行语句;
  11. done结束;
Copy the Code
Reply View the author