shell报错pushd:not found

2019-05-14

shell行首用了#!/bin/sh,进入目录用了pushd/popd

1、ls -l /bin/sh 发现指向的是/bin/dash
2、dpkg-query -S /bin/dash
3、rpm -qf /bin/dash
4、由于使用了/bin/sh 导致找不到pushd命令
切换回/bin/bash即可,但是我在shell中声明#!/bin/bash还是继续报错

看到一句解释如下:

This has to do with /bin/sh being linked to /bin/dash instead of /bin/bash in ubuntu’s  latest releases.
To fix it once and for all do the following:

使用下面的方法:

  # mv  /bin/sh   /bin/sh-mod
  # ln -s /bin/bash /bin/sh

分类:Linux | 标签: |

相关日志

评论被关闭!