金曜日, 11月 27, 2009

set -- *.ps

bash - test for no files matching *.foo

set -- *.ps
if [ -f "$1" ]
then
w3flag=$#
else
w3flag=0
fi


Bash file "if exist" and looping question - Questions

Linux tip: Bash test and comparison functions


Unix: Check if a file exists with certain prefix
shopt -s nullglob
x=(ABC*)
if [ -n "$x" ]; then
echo foo
else
echo bar
fi


For debugging or see what is going on in a script
set -xv # enable debugging

0 件のコメント: