Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Saturday, March 7, 2026

File: [Platon] / scripts / shell / ssh-utils / put (download)

Revision 1.10, Fri Sep 8 06:50:10 2006 UTC (19 years, 6 months ago) by nepto


Changes since 1.9: +2 -2 lines

Updated copyright year

#!/bin/sh

#
# scripts/shell/ssh-utils/ - SSH related shell utils
#
# put/get - puts file to destination server or
#           gets file from destination server
# ____________________________________________________________
#
# Developed by Lubomir Host <rajo@platon.sk>
# Copyright (c) 2002-2006 Platon Group, http://platon.sk/
# All rights reserved.
#
# See README file for more information about this software.
# See COPYING file for license information.
#
# Download the latest version from
# http://platon.sk/projects/scripts/
#

#
# $Platon: scripts/shell/ssh-utils/put,v 1.9 2006-09-08 06:49:30 nepto Exp $
#

default_user="${user:=$USER}";
user='';
machine='';

ssh_put()
{
    tar cf - "$@" | ssh -l "$user" "$machine" -e none tar xvf -;
}

ssh_get()
{
    ssh -l "$user" "$machine" -e none tar cf - "$@" | tar xvf -;
}

if [ "$#" -lt 1 ]; then
    echo
    echo "Usage: $0 <files>";
    echo
    exit 1;
fi

echo "Default username is '$default_user', press ENTER to use this."; 
echo -en "Enter username: ";
read user;

if [ -z "$user" ]; then
    echo "No username specified, using default: $default_user";
    user="$default_user";
fi

echo -en "Enter hostname: ";
read machine;

if [ -z "$machine" ]; then
    echo "No hostname specified.";
    exit 1;
fi

# if called with name 'put' --> try ssh_put()
#                     'get' --> try ssh_get()
case $0  in
    *put) ssh_put "$@";
    ;;
    *get) ssh_get "$@";
    ;;
esac

# vim: ft=sh


Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top