You are not logged in.
Hello, I made these two scripts to upload files to a remote server using ssh:
up() {
R=$(perl -le 'print map { unpack "H*", chr(rand(256)) } 1..2').$(perl -e "\$ext = \"$1\"; \$ext =~ s/.*\.(.*)\$/\$1/; print \$ext")
scp "$*" myserver.net:/var/www/myserver.net/$R
echo http://myserver.net/$R
echo -n http://myserver.net/$R | xclip -selection clipboard
}
upc() {
scp "$*" myserver.net:/var/www/myserver.net
echo http://myserver.net/$*
echo -n http://myserver.net/$* | xclip -selection clipboard
}
up() uploads the file with a random name and upc() uploads the file with the same name it had in my machine.
But these scripts are real crap; upc() won't work with files with spaces and will output a wrong name when uploading files that are in a directory different from $PWD and up() doesn't work when the file is in $PWD, so I have to use `up ./file.png`.
Can you provide me a better solution or other scripts? Thank you.
Offline