Created
June 20, 2012 09:00
-
-
Save isann/2958925 to your computer and use it in GitHub Desktop.
指定した名前に一致するパスを取得するBASH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RET=`ls /home/user/a_*dat` # a_ではじまりdatで終わるファイルの一覧 | |
if [[ $? -ne 0 ]] # a_ではじまりdatで終わるファイルが1つもないと0以外の終了値になる | |
then | |
exit 9 | |
else | |
for TXT in $RET # a_ではじまりdatで終わるファイルが1つ以上あったとき | |
do | |
echo ${TXT} # ファイルパスを出力する | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment