Linux 命令 let: not found

ubuntush???.sh时出现let:notfound

(我的sh文件里有mv命令,结果文件全丢失了)

出现问题的原因:It'sbecauseUbuntuusesthedashshellasdefaultanddoesn'talwaysrecognizewhenyoutrytosettheshellinascript.Evenifyouenter"echo$SHELL"intotheconsoleitwilltellyouyou'reusing/bin/bashbutforsomereasonit'sactuallyusingdashinstead.

#就是bash环境指向了/bin/sh,而在/bin/bash里才有let命令。

解决办法:

sudodpkg-reconfiguredash

<password>

andwhenyougettheoptionselect"no"toactuallyusebashinsteadofdash

其实也可改用bash???.sh指令

相关推荐