View previous topic :: View next topic |
Author |
Message |
Stu L Tissimus Veteran
Joined: 08 Jun 2003 Posts: 1339 Location: NJ, 5 minutes from NYC
|
Posted: Fri Mar 05, 2004 4:21 pm Post subject: Could somebody help me make this command? |
|
|
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 . 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 |
|
|
lazarusrat Guru
Joined: 17 Jul 2002 Posts: 305 Location: Lafayette, IN
|
Posted: Fri Mar 05, 2004 4:37 pm Post subject: |
|
|
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 |
|
|
shm Advocate
Joined: 09 Dec 2002 Posts: 2380 Location: Atlanta, Universe
|
Posted: Fri Mar 05, 2004 4:38 pm Post subject: |
|
|
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 |
|
|
|
|
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
|
|