Bash script. How to join two IF in one?
I wanna check 3 conditions all together
1. file exist 2. its extention is java 3. in first 120 lines it has $Revision word somewere if [ -f $f ]; then if echo "$f" | grep '.*\.java$' > /dev/null; then if head -120 < "$f" | grep '\$Revision' > /dev/null then ... it works Ok, but how to join them in one if? How to deal with ramifications in a more compex case? |
Separate the conditions with &&
if [ -e $f ] && whatever; then fi |
All times are GMT -5. The time now is 12:05 AM. |