这是我用来卸载软件包的shell脚本。它支持GHC的多个安装版本,并且还擦除相关文件(但提供时不作任何担保,如果您用软管安装,请不要怪我!)
#!/bin/bash -eu
: ${VER:=}
if [ "$#" -lt 1 ]
then
echo "Usage: $0 [--force | --no-unregister] pkgname-version"
exit 1
fi
if [ "$1" == "--force" ]
then force=--force; shift;
else force=
fi
if [ "$1" == "--no-unregister" ]
then shift
else
if [ "$(ghc-pkg$VER latest $1)" != "$1" ]
then
ghc-pkg$VER list $1; exit 1
fi
ghc-pkg$VER unregister $force $1
fi
rm -rfv -- ~/.cabal/lib/$1/ghc-$(ghc$VER --numeric-version)/
if rmdir -- ~/.cabal/lib/$1
then rm -rfv -- ~/.cabal/share/{,doc/}$1
fi
ghc-pkg list blaze-html
?您确定以正确的用户身份运行它吗?也许明确指出要注销的版本?