Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ┌─[~]
- └─[alexey@home]: cat ./tmp/javatest.sh
- # formula 1
- if [[ ${1:0:3} < "1.8" ]]; then
- echo "v:0:3: $1 < 1.8"
- else
- echo "v:0:3: $1 > 1.8"
- fi
- # formula 2
- if [[ "${1}" > "1.8" ]]; then
- echo "version $1 > 1.8"
- else
- echo "version $1 < 1.8"
- fi
- ┌─[~]
- └─[alexey@home]: bash ./tmp/javatest.sh "1.7.1"
- v:0:3: 1.7.1 < 1.8
- version 1.7.1 < 1.8
- ┌─[~]
- └─[alexey@home]: bash ./tmp/javatest.sh "1.7"
- v:0:3: 1.7 < 1.8
- version 1.7 < 1.8
- ┌─[~]
- └─[alexey@home]: bash ./tmp/javatest.sh "1.8"
- v:0:3: 1.8 > 1.8
- version 1.8 < 1.8
- ┌─[~]
- └─[alexey@home]: bash ./tmp/javatest.sh "1.8.1"
- v:0:3: 1.8.1 > 1.8
- version 1.8.1 > 1.8
- ┌─[~]
- └─[alexey@home]: bash -version
- GNU bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu)
- Copyright (C) 2011 Free Software Foundation, Inc.
- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
- This is free software; you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law.
- ┌─[~]
- └─[alexey@home]: uname -a
- Linux home 3.12.13-gentoo #1 SMP Sat Mar 15 20:16:27 YEKT 2014 x86_64 Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz GenuineIntel GNU/Linux
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement