Advertisement
kardapoltsev

java_version_test

Mar 29th, 2014
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.21 KB | None | 0 0
  1. ┌─[~]
  2. └─[alexey@home]: cat ./tmp/javatest.sh
  3. # formula 1
  4. if [[ ${1:0:3} < "1.8" ]]; then
  5.     echo "v:0:3: $1 < 1.8"
  6.   else
  7.     echo "v:0:3: $1 > 1.8"
  8. fi
  9.  
  10. # formula 2
  11. if [[ "${1}" > "1.8" ]]; then
  12.     echo "version $1 > 1.8"
  13.   else
  14.     echo "version $1 < 1.8"
  15. fi
  16.  
  17. ┌─[~]
  18. └─[alexey@home]: bash ./tmp/javatest.sh "1.7.1"
  19. v:0:3: 1.7.1 < 1.8
  20. version 1.7.1 < 1.8
  21.  
  22. ┌─[~]
  23. └─[alexey@home]: bash ./tmp/javatest.sh "1.7"
  24. v:0:3: 1.7 < 1.8
  25. version 1.7 < 1.8
  26.  
  27. ┌─[~]
  28. └─[alexey@home]: bash ./tmp/javatest.sh "1.8"
  29. v:0:3: 1.8 > 1.8
  30. version 1.8 < 1.8
  31.  
  32. ┌─[~]
  33. └─[alexey@home]: bash ./tmp/javatest.sh "1.8.1"
  34. v:0:3: 1.8.1 > 1.8
  35. version 1.8.1 > 1.8
  36.  
  37. ┌─[~]
  38. └─[alexey@home]: bash -version
  39. GNU bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu)
  40. Copyright (C) 2011 Free Software Foundation, Inc.
  41. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  42.  
  43. This is free software; you are free to change and redistribute it.
  44. There is NO WARRANTY, to the extent permitted by law.
  45.  
  46. ┌─[~]
  47. └─[alexey@home]: uname -a
  48. 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