分页: 1 / 1

let: not found 是啥意思?(已解决)

发表于 : 2008-11-17 6:26
foriany
test.sh代码:
#!/bin/bash
let i=0;
echo $i;
let i=i+1;
echo $i;

执行结果:
$ sh test.sh
test.sh: 2: let: not found

test.sh: 4: let: not found

单单执行let命令是有回应的
$ let i=0;
$ echo $i;
0
$ let i=i+1;
$ echo $i;
1

原来ubuntu用的是dash 而不是bash
如需将默认的shell改回bash,可以在执行sudodpkg-reconfiguredash后,选择no。