首页 > 系统相关 >shell字符串截取报错 Bad substitution 的解决方法

shell字符串截取报错 Bad substitution 的解决方法

时间:2022-11-17 09:22:46浏览次数:35  
标签:bin shell sudo dash Bad 报错 bash

问题:

  脚本执行到截取字符串时,报错提示:Bad substitution。

原因:

  两种shell语言解释器 bash和dash,这种情况是指向了dash解释器导致。

解决方法:

  1.查看shell指向:ls -l /bin/sh

  2.修改脚本指向bash方法1:sudo dpkg-reconfigure dash 然后选择 no

     修改脚本指向bash方法2:sudo rm -rf /bin/sh  sudo ln -s /bin/bash /bin/sh

标签:bin,shell,sudo,dash,Bad,报错,bash
From: https://www.cnblogs.com/xingboy/p/16898309.html

相关文章