Fread_dir.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/bash
  2. #set -x
  3. set -o posix
  4. #set -u
  5. #set -e
  6. #+
  7. #
  8. # ============
  9. # Fread_dir.sh
  10. # ============
  11. #
  12. # ---------------------
  13. # Read user directories
  14. # ---------------------
  15. #
  16. # SYNOPSIS
  17. # ========
  18. #
  19. # ::
  20. #
  21. # $ Fread_dir.sh
  22. #
  23. #
  24. # DESCRIPTION
  25. # ===========
  26. #
  27. #
  28. # Read directoires needed from standard input
  29. #
  30. # EXAMPLES
  31. # ========
  32. #
  33. # ::
  34. #
  35. # $ ./Fread_dir.sh Directory_NAME YES/NO
  36. #
  37. #
  38. # TODO
  39. # ====
  40. #
  41. # option debug
  42. #
  43. #
  44. # EVOLUTIONS
  45. # ==========
  46. #
  47. # $Id: Fread_dir.sh 3294 2012-01-28 16:44:18Z rblod $
  48. #
  49. #
  50. #
  51. # * creation
  52. #
  53. #-
  54. if [ "$2" == "YES" ]; then
  55. echo -n " $1 [Y/n] "
  56. read answer
  57. answer=`echo $answer | sed 's/^[yY].*$/y/'`
  58. if [ -z "$answer" -o "x$answer" = "xy" ]; then
  59. TAB[$ind]="$1"
  60. let ind=ind+1
  61. echo " $1 selected "
  62. echo " "
  63. else
  64. echo " $1 Not selected "
  65. echo " "
  66. fi
  67. unset -v answer
  68. else
  69. echo -n " $1 [y/N] "
  70. read answer
  71. answer=`echo $answer | sed 's/^[nN].*$/N/'`
  72. if [ "x$answer" = "xy" ]; then
  73. TAB[$ind]="$1"
  74. let ind=ind+1
  75. echo " $1 selected "
  76. echo " "
  77. else
  78. echo " $1 Not selected "
  79. echo " "
  80. fi
  81. unset -v answer
  82. fi