Thanks for the pointers.  They helped out a lot. The script I ended up
with is:

#!/bin/bash
if [ $# -eq 0 ]; then
    echo I need to know the file/directory to copy
else
    if [ $# -eq 1 ]; then
        scp -r $1 u...@somehost:~/upload/
    else
        scp -r $1 u...@somehost:~/$2/
    fi
fi

I named the script scp_hostname, and then made an alias to it in
the .bashrc.

On Oct 11, 2:57 pm, Daniel Eggleston <[email protected]> wrote:
> Yes - have a look at bash's documentation, especially regarding functions.
> You can declare functions in your bashrc.  You can make one similar to this
> (not 100% accurate since I can't remember the syntax off the top of my
> head):
>
> sub scp() {
>     if [ numargs -lt 2 ]; then
>         /usr/bin/scp $1 u...@somehost:
>     else
>         /usr/bin/scp $@   <<< $@ means the whole arg list.
>     fi
>
> }
>
> Then, calling "scp somefile" will invoke "/usr/bin/scp somefile
> u...@somehost:"

-- 
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit our group at 
http://groups.google.com/group/linuxusersgroup

Reply via email to