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:" On Mon, Oct 11, 2010 at 5:38 AM, genxtech <jrmy.l...@gmail.com> wrote: > Would that be done via a bash script? > > On Oct 10, 9:19 pm, Daniel Eggleston <egg...@gmail.com> wrote: > > sort of. You can: > > alias file_to_copy="file_to_copy u...@remote:" > > > > Unfortunately, that will get expanded when you run commands like 'cat'. > > > > Another option is to create a new function in bash to replace scp. Your > > function can detect the single filename and expand that into the real scp > > command. > > > > > > > > On Sun, Oct 10, 2010 at 8:09 PM, genxtech <jrmy.l...@gmail.com> wrote: > > > I have gotten to the point in my use of Linux that I have set up a few > > > aliases in my .bashrc and .bash_profile files that call bash scripts > > > to ssh into other machines. I was wondering whether it would be > > > possible to do something similar with scp. Maybe typing: alias > > > file_to_copy instead of typing scp file_to_copy > > > usern...@remote_machine. > > > > > I know it's good to try and google for a solution first, but I was > > > unsure what to google for. > > > > > -- > > > You received this message because you are subscribed to the Linux Users > > > Group. > > > To post a message, send email to linuxusersgroup@googlegroups.com > > > To unsubscribe, send email to > linuxusersgroup-unsubscr...@googlegroups.com > > > For more options, visit our group at > > >http://groups.google.com/group/linuxusersgroup > > > > -- > > > > Daniel > > -- > You received this message because you are subscribed to the Linux Users > Group. > To post a message, send email to linuxusersgroup@googlegroups.com > To unsubscribe, send email to linuxusersgroup-unsubscr...@googlegroups.com > For more options, visit our group at > http://groups.google.com/group/linuxusersgroup > -- Daniel -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to linuxusersgroup@googlegroups.com To unsubscribe, send email to linuxusersgroup-unsubscr...@googlegroups.com For more options, visit our group at http://groups.google.com/group/linuxusersgroup