Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "Enter if the tag is present in
- Dev
- Test
- Prod
- "
- while :
- do
- read -r INPUT_STRING
- INPUT_STRING=`echo $INPUT_STRING | tr '[:lower:]' '[:upper:]'`
- case $INPUT_STRING in
- test | TEST)
- echo "Please enter Tag no : "
- read -r input_variable
- if [[ ${#input_variable} -ne "7" ]]
- then
- echo "Please check the Tag no"
- exit 1
- fi
- HOST=xxxx
- USER=xxxx
- PASSWORD=xxxx
- mypath="/path/to/$input_variable/"
- ftp -inv $HOST <<- EOF > FTPLOG
- user $USER $PASSWORD
- cd "$mypath"
- pwd
- mput x
- mput y.csv
- mput x.csv
- mput a.csv
- mput b.out
- EOF
- fgrep "550 Failed to change directory" FTPLOG >& /dev/null
- if [[ $? -eq 0 ]]
- then
- echo "File is not transfered to the tag $input_variable. Please check the
- tag no given"
- else
- echo "File is transfered to the tag $input_variable"
- fi
- exit 1
- ;;
- *)
- echo "Error: Invalid option..."
- exit 1
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement