2018-02-10 16:27:53 -05:00

26 lines
1.6 KiB
Bash

#!/bin/bash
#Benjamyn Love 2017
#this script will generate imapsync commmands from email account information that we supply (hopefully)
## Usage for imapsync in its most basic form
# imapsync --host1 [Domain name or the IP of the source server] --user1 [Username of the source account (Usally the email address iteself, it depends on how the server auths)] --pass1 [The password for the source account] --host2 [Domain name or the IP of the destination server] [Other --*1 params] --user2 [Username of the destination account (Usally the email address iteself, it depends on how the server auths)] --pass1 [The password for the detination account] [Other --*2 params]
# Using my email account as a baseline test@benjamyn-testing.com will be moved to test2@benjamyn-testing.com[Other --*2 params]
# The command will look like:
# Using my email account as a baseline test@benjamyn-testing.com will be moved to test2@benjamyn-testing.com
# imapsync --host1 benjamny-testing.com --user1 "test@benjamyn-testing.com" --pass1 '"password1"' --user2 "test2@benjamyn-testing.com" --pass2 '"pas$w0rd*("'
# Note the ' followed by the " this makes sure the shell will not glob any of the special chars in the password
# Ideas for usage of this script
# Add server IP/Domain to a file followed by usernames and passwords
# i.e
# mail.benjamyn-testing.com
# test@benjamyn.testing.com,password1,test2@benjamyn-testing.com,password2
#
# The aboce will not work... fucking passwords
# Will need to use tab delimiters ' '
#
## TODO Stop being a basic bitch and change it to just use awk
cat $1 | while read a; do echo $a | awk '{print $1 $2 $3 $4}'; done