-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello, guys, I visited your place last week, and as I told you, I was going
to try out bash for FTP upload, and in fact this went surprisingly well:
1. relatively trivilal, upload one file only, you find some examples for
this online:
> andrew@a68n:/mnt/nasd/transfer/attachment$ cat attach-one.sh
> #!/bin/bash
> #
> echo "Uploading one file as attachment from ./ "$(pwd)" ..."
> pftp -i 188.40.28.11 <<EOF
> cd public_html/attachment/
> put $1
> bye
> EOF
> echo -n "
https://attachment.irregulaire.info/"$1 | xclip -i -selection
> clipboard exit
2. a bit more tricky: upload several files:
> andrew@a68n:/mnt/nasd/transfer/attachment$ cat attachm.sh
> #!/bin/bash
> ##greetings and create ftpcmds-file and ulinks
> echo " "$#" files to upload:"
> echo "cd public_html/attachment/" > ftpcmds.tx
> echo "" > ulinks.tx
> ##populate file with put-commands and progress-indications
> until [ $# -eq 0 ]
> do
> echo "put $1" >> ftpcmds.tx
> echo "
https://attachment.irregulaire.info/$1" >> ulinks.tx
> echo "! echo 'uploaded '$1' .'" >> ftpcmds.tx
> shift
> done
> echo "bye" >> ftpcmds.tx
> ##now execute the uploads:
> pftp -i 188.40.28.11 <ftpcmds.tx
> cat ftpcmds.tx
> echo "Done, putting links into clipboard:"
> cat ulinks.tx
> ## move links to clipboard:
> cat ulinks.tx | xclip -i -selection clipboard
> rm ulinks.tx ftpcmds.tx
> exit
This works well, even wildcards are resolved correctly as in my example (*):
> andrew@a68n:/mnt/nasd/transfer/attachment$ ./attachm.sh *.jpg
> 3 files to upload:
> Password:
> uploaded datenschmutz-s-bahn.jpg .
> uploaded DSC_0435.jpg .
> uploaded DSC_0439.jpg .
> cd public_html/attachment/
> put datenschmutz-s-bahn.jpg
> ! echo 'uploaded 'datenschmutz-s-bahn.jpg' .'
> put DSC_0435.jpg
> ! echo 'uploaded 'DSC_0435.jpg' .'
> put DSC_0439.jpg
> ! echo 'uploaded 'DSC_0439.jpg' .'
> bye
> Done, putting links into clipboard:
>
>
https://attachment.irregulaire.info/datenschmutz-s-bahn.jpg
>
https://attachment.irregulaire.info/DSC_0435.jpg
>
https://attachment.irregulaire.info/DSC_0439.jpg
I have the login-name in .netrc, but no plain-text password.
And I do have this in the clipboard afterwards to paste it into the
e-mail (here as quotation):
>
https://attachment.irregulaire.info/datenschmutz-s-bahn.jpg
>
https://attachment.irregulaire.info/DSC_0435.jpg
>
https://attachment.irregulaire.info/DSC_0439.jpg
And the pictures are really there, see:
> andrew@a68n:/mnt/nasd/transfer/attachment$ wget
>
https://attachment.irregulaire.info/datenschmutz-s-bahn.jpg --2019-05-11
> 13:47:49--
https://attachment.irregulaire.info/datenschmutz-s-bahn.jpg
> Resolving
attachment.irregulaire.info (
attachment.irregulaire.info)...
> 188.40.28.11 Connecting to
attachment.irregulaire.info
> (
attachment.irregulaire.info)|188.40.28.11|:443... connected. HTTP request
> sent, awaiting response... 200 OK Length: 1292553 (1.2M) [image/jpeg]
> Saving to: ‘datenschmutz-s-bahn.jpg.1’
>
> datenschmutz-s-bahn.j 100%[========================>] 1.23M 6.81MB/s
> in 0.2s
>
> 2019-05-11 13:47:53 (6.81 MB/s) - ‘datenschmutz-s-bahn.jpg.1’ saved
> [1292553/1292553]
>
Cheers!
P.S. If you work for Mozilla-Denmark, doesn't this make you danish agents in
Berlin, technically speaking?
-----BEGIN PGP SIGNATURE-----
iF0EARECAB0WIQTF9uNaslvnJpWt8kXn6sEfJS3nCwUCXNa3QAAKCRDn6sEfJS3n
C1HpAJ4paM6Zuxtt65KCST3oxxBhRfRb5QCcD5put7scr3oTePNe/hu7Aw7rJxw=
=76MA
-----END PGP SIGNATURE-----