Simple bash script hanging inside an if statement

I have a few bash scripts (saved as .command on a mac) that I use to make my life easier, and have come across a problem in a very simple script that I can't work out.

The following code will hang inside the IF. The component code inside the loop works fine if run by itself.

#!/bin/bash

#Delete auxilary latex files in current folder and all subfolders
echo "Delete LaTeX Aux files for subdirectories? [Y,n]"
read input
if [[ $input == "Y" || $input == "y" ]]; then
        find . -type f -name '*.aux' -delete
        find . -type f -name '*.bbl' -delete
        find . -type f -name '*.blg' -delete
        find . -type f -name '*.log' -delete
        find . -type f -name '*.synctex.gz' -delete
fi

Probably a simple error. Not sure what though... it is basically identical to other tools I've written.

Many thanks for any help!

PS. made the file executable via chmod +x filename

链接地址: http://www.djcxy.com/p/56788.html

上一篇: 在脚本中更改PWD以允许访问文件,而无需为完整路径添加前缀

下一篇: 简单的bash脚本挂在if语句中