on-internet
← Community

bash upload to sftp and moving files. looping around

Stack Overflow ·

Im somewhat beginner in bash scripting. I have here part of script that uploades files to sftp server. Then it shoud move files to other directory. Else echo info about no files in source_dir. Problem is that its not moving files and is looping back to sftp login after files are already uploaded. cd /dest_dir/ for file5 in *.test do if test -f $file5 then echo 'some text.' (( echo " cd /dest_dir/ lcd /source_dir/ mput *.test exit " ) | sftp "user"@"host") sleep 3 mv /source_dir/$file5 /source_dir/test/ else echo -e 'some text' fi

Comments

Sign in or sign up to comment and upvote.

No comments yet.