#!/bin/bash
i=1
sum=0
while [ $i -le 100 ]
do
  let sum=sum+$i
  let i++

done

在写一个简单的循环脚本时,报错 let: not found,在ubuntu默认是指向bin/dash解释器的,dash是阉割版的bash,其功能远没有bash强大和丰富.并且dash不支持let和i++等功能.

 

解决办法:

    sudo dpkg-reconfigure dash   选择 "否", 表示用bash代替dash

 

相关文章:

  • 2021-08-24
  • 2021-09-12
  • 2021-12-03
  • 2021-07-16
  • 2022-12-23
  • 2021-11-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案