这就是我想要做的:
@H_301_10@#!/bin/bash set -e # I can't remove this line! if [ docker inspect foo ]; then echo container is present else echo container is absent fi
可能吗? docker inspect foo在容器不存在时返回退出代码1,当它出现时返回0.
现在我明白了:
-bash: [: too many arguments