Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Could somebody help me make this command?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Stu L Tissimus
Veteran
Veteran


Joined: 08 Jun 2003
Posts: 1339
Location: NJ, 5 minutes from NYC

PostPosted: Fri Mar 05, 2004 4:21 pm    Post subject: Could somebody help me make this command? Reply with quote

I like to make easy commands to do stuff. For instance, /usr/bin/suspend for apm --suspend. And corktoothssh to ssh into my webpage host.

Anyway, after finally getting scp to work, I would like to make a command so that I can easily copy something onto the server without typing much in. Right now I have to do scp <pathtofile> stu_l_tissimus@corktooth.dyndns.org:/home/stu_l_tissimus/<filename>. I don't want to do this all the time :D . I could just like tomake a command so that I could do, say, ctscp <pathtofile>. Could somebody help? It's possible for me to do it with variables file FILE="/path/to/file" ctscp, but is there an easier way?
_________________
old outdated sig
Back to top
View user's profile Send private message
lazarusrat
Guru
Guru


Joined: 17 Jul 2002
Posts: 305
Location: Lafayette, IN

PostPosted: Fri Mar 05, 2004 4:37 pm    Post subject: Reply with quote

In shell scripts, $1 is the first command-line argument, $2 is the second, etc.
So an easy one would be:
Code:

#/bin/sh
scp $1 stu_l_tissimus@corktooth.dyndns.org:/home/stu_l_tissimus/$2

which would let you do ctsp /path/to/file filenameonserver.
There's a way to extract the path out of the /path/to/file, but I'm drawing a blank on that right now.
_________________
obpiper: pipe menu generator for openbox
obtheme: pipe menu to switch openbox themes
Back to top
View user's profile Send private message
shm
Advocate
Advocate


Joined: 09 Dec 2002
Posts: 2380
Location: Atlanta, Universe

PostPosted: Fri Mar 05, 2004 4:38 pm    Post subject: Reply with quote

lazarusrat wrote:

There's a way to extract the path out of the /path/to/file, but I'm drawing a blank on that right now.


basename
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum