Advertisement
Guest User

Untitled

a guest
May 23rd, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. #!/bin/bash
  2. echo "Enter if the tag is present in
  3. Dev
  4. Test
  5. Prod
  6. "
  7. while :
  8. do
  9. read -r INPUT_STRING
  10. INPUT_STRING=`echo $INPUT_STRING | tr '[:lower:]' '[:upper:]'`
  11. case $INPUT_STRING in
  12. test | TEST)
  13. echo "Please enter Tag no : "
  14. read -r input_variable
  15. if [[ ${#input_variable} -ne "7" ]]
  16. then
  17. echo "Please check the Tag no"
  18. exit 1
  19. fi
  20. HOST=xxxx
  21. USER=xxxx
  22. PASSWORD=xxxx
  23. mypath="/path/to/$input_variable/"
  24. ftp -inv $HOST <<- EOF > FTPLOG
  25. user $USER $PASSWORD
  26. cd "$mypath"
  27. pwd
  28. mput x
  29. mput y.csv
  30. mput x.csv
  31. mput a.csv
  32. mput b.out
  33. EOF
  34. fgrep "550 Failed to change directory" FTPLOG >& /dev/null
  35. if [[ $? -eq 0 ]]
  36. then
  37. echo "File is not transfered to the tag $input_variable. Please check the
  38. tag no given"
  39. else
  40. echo "File is transfered to the tag $input_variable"
  41. fi
  42. exit 1
  43. ;;
  44. *)
  45. echo "Error: Invalid option..."
  46. exit 1
  47. ;;
  48. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement