testコマンドのファイルの存在確認(-eオプション)でワイルドカードは使えない。代替としてはlsを使うとか…
$ ls
a.txt b.txt
$ test -e *.txt && echo "exists"
$ (ls *.txt >& /dev/null) && echo "exists"
exists
More than 5 years have passed since last update.
testコマンドのファイルの存在確認(-eオプション)でワイルドカードは使えない。代替としてはlsを使うとか…
$ ls
a.txt b.txt
$ test -e *.txt && echo "exists"
$ (ls *.txt >& /dev/null) && echo "exists"
exists
Register as a new user and use Qiita more conveniently
Go to list of users who liked