Re: rsync or even scp questions....

2008-10-13 Thread Jeremy Hooks
 How, may I ask, does this work?

If you search the bash man file you can find this and lots of other useful
constructs, search for 'Parameter Expansion' - I'm not sure how much of this
relates to other Bourne Shell derivatives, but I don't imagine it would be
difficult to test it out.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rsync or even scp questions....

2008-10-12 Thread Matthew Seaman

mdh wrote:

--- On Sat, 10/11/08, Gary Kline [EMAIL PROTECTED] wrote:

On the Ubuntu computer I am /home/kline; on my main
computer,
my home is /usr/home/kline.   The following sh script
worked
perfected when my home on tao [FBSD] was
/home/kline:

P
#!/bin/sh

PWD=`pwd`;
echo This directory is [${PWD}];

scp -qrp  ${PWD}/* ethos:/${PWD}
###/usr/bin/scp -rqp -i /home/kline/.ssh/zeropasswd-id
${PWD}/* \ klin
[EMAIL PROTECTED]:/${PWD}

Question #1: is there any /bin/sh method of getting rid of
the
/usr?  I switch off between my two computers
especially when
get mucked up, as with my upgrade to kde4.  (Otherwise, I
do
backups of ~kline as well as other critical directories.)

Is there a way of automatically using rsync rather that my
kwik-and-dirty /bin/shell script?

thanks, people,

gary


If what you wish to do is simply get rid of /usr in a string, you can use sed 
like so:
varWithoutUsr=`echo ${varWithUsr} |sed -e 's/\/usr//'`
After running this, where $varWithUsr is the variable containing a string like /usr/home/blah, the variable $varWithoutUsr will be equal to /home/blah.  I create simple scripts like this all the time to rename batches of files, for example.  

The easier way is probably just to not specify a dir to scp's remote path though, since it defaults to the user's home directory.  


Or, in anything resembling Bourne shell:

varWithoutUsr=${varWithUsr#/usr}

Cheers,

Matthew

--
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
 Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
 Kent, CT11 9PW



signature.asc
Description: OpenPGP digital signature


Re: rsync or even scp questions....

2008-10-12 Thread Jeremy Chadwick
On Sun, Oct 12, 2008 at 09:42:38AM +0100, Matthew Seaman wrote:
 mdh wrote:
 --- On Sat, 10/11/08, Gary Kline [EMAIL PROTECTED] wrote:
 On the Ubuntu computer I am /home/kline; on my main
 computer,
 my home is /usr/home/kline.   The following sh script
 worked
 perfected when my home on tao [FBSD] was
 /home/kline:

 P
 #!/bin/sh

 PWD=`pwd`;
 echo This directory is [${PWD}];

 scp -qrp  ${PWD}/* ethos:/${PWD}
 ###/usr/bin/scp -rqp -i /home/kline/.ssh/zeropasswd-id
 ${PWD}/* \ klin
 [EMAIL PROTECTED]:/${PWD}

 Question #1: is there any /bin/sh method of getting rid of
 the
 /usr?  I switch off between my two computers
 especially when
 get mucked up, as with my upgrade to kde4.  (Otherwise, I
 do
 backups of ~kline as well as other critical directories.)

 Is there a way of automatically using rsync rather that my
 kwik-and-dirty /bin/shell script?

 thanks, people,

 gary

 If what you wish to do is simply get rid of /usr in a string, you can use 
 sed like so:
 varWithoutUsr=`echo ${varWithUsr} |sed -e 's/\/usr//'`
 After running this, where $varWithUsr is the variable containing a 
 string like /usr/home/blah, the variable $varWithoutUsr will be equal 
 to /home/blah.  I create simple scripts like this all the time to 
 rename batches of files, for example.  

 The easier way is probably just to not specify a dir to scp's remote 
 path though, since it defaults to the user's home directory.  

 Or, in anything resembling Bourne shell:

 varWithoutUsr=${varWithUsr#/usr}

And I'll take a moment to recommend Matthew's method, since it does not
involve fork()ing an additional process.

When writing shell scripts in general, it's best if you can avoid
spawning external processes for things which can be done easily
(keyword: easily!) within Bourne natively.  There's no harm in doing it
for more complex things, but fork() is somewhat expensive, and try to
imagine what will happen to those scripts if the system lacks process
table space, etc...  :-)  Best to try and make everything
self-contained if possible.

-- 
| Jeremy Chadwickjdc at parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rsync or even scp questions....

2008-10-12 Thread Gary Kline
On Sun, Oct 12, 2008 at 09:42:38AM +0100, Matthew Seaman wrote:
 mdh wrote:
 --- On Sat, 10/11/08, Gary Kline [EMAIL PROTECTED] wrote:
 On the Ubuntu computer I am /home/kline; on my main
 computer,
 my home is /usr/home/kline.   The following sh script
 worked
 perfected when my home on tao [FBSD] was
 /home/kline:
 
 P
 #!/bin/sh
 
 PWD=`pwd`;
 echo This directory is [${PWD}];
 
 scp -qrp  ${PWD}/* ethos:/${PWD}
 ###/usr/bin/scp -rqp -i /home/kline/.ssh/zeropasswd-id
 ${PWD}/* \ klin
 [EMAIL PROTECTED]:/${PWD}
 
 Question #1: is there any /bin/sh method of getting rid of
 the
 /usr?  I switch off between my two computers
 especially when
 get mucked up, as with my upgrade to kde4.  (Otherwise, I
 do
 backups of ~kline as well as other critical directories.)
 
 Is there a way of automatically using rsync rather that my
 kwik-and-dirty /bin/shell script?
 
 thanks, people,
 
 gary
 
 If what you wish to do is simply get rid of /usr in a string, you can use 
 sed like so:
 varWithoutUsr=`echo ${varWithUsr} |sed -e 's/\/usr//'`
 After running this, where $varWithUsr is the variable containing a string 
 like /usr/home/blah, the variable $varWithoutUsr will be equal to 
 /home/blah.  I create simple scripts like this all the time to rename 
 batches of files, for example.  
 The easier way is probably just to not specify a dir to scp's remote path 
 though, since it defaults to the user's home directory.  
 
 Or, in anything resembling Bourne shell:
 
 varWithoutUsr=${varWithUsr#/usr}


I'll be damrned!  It works--I've used the zsh for almost 20
years; it's a ksh clone++.  How, may I ask, does this work?
(I've seen ksh chopping from the RHS; I wrote a short C util to
axe any part of a string, but have never seen  *this* voodoo.
LOL++)

In any event, merci infiniement!

gary

PS: this will save my rsync scripts too.


 
   Cheers,
 
   Matthew
 
 -- 
 Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
  Flat 3
 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
  Kent, CT11 9PW
 



-- 
 Gary Kline  [EMAIL PROTECTED]  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rsync or even scp questions....

2008-10-12 Thread Gary Kline
On Sun, Oct 12, 2008 at 01:49:31AM -0700, Jeremy Chadwick wrote:
 On Sun, Oct 12, 2008 at 09:42:38AM +0100, Matthew Seaman wrote:
  mdh wrote:
  --- On Sat, 10/11/08, Gary Kline [EMAIL PROTECTED] wrote:
On the Ubuntu computer I am /home/kline; on my main
  computer,
my home is /usr/home/kline.   The following sh script
  worked
perfected when my home on tao [FBSD] was
  /home/kline:
 
  P
  #!/bin/sh
 
  PWD=`pwd`;
  echo This directory is [${PWD}];
 
  scp -qrp  ${PWD}/* ethos:/${PWD}
  ###/usr/bin/scp -rqp -i /home/kline/.ssh/zeropasswd-id
  ${PWD}/* \ klin
  [EMAIL PROTECTED]:/${PWD}
 
Question #1: is there any /bin/sh method of getting rid of
  the
/usr?  I switch off between my two computers
  especially when
get mucked up, as with my upgrade to kde4.  (Otherwise, I
  do
backups of ~kline as well as other critical directories.)
 
Is there a way of automatically using rsync rather that my
kwik-and-dirty /bin/shell script?
 
thanks, people,
 
gary
 
  If what you wish to do is simply get rid of /usr in a string, you can use 
  sed like so:
  varWithoutUsr=`echo ${varWithUsr} |sed -e 's/\/usr//'`
  After running this, where $varWithUsr is the variable containing a 
  string like /usr/home/blah, the variable $varWithoutUsr will be equal 
  to /home/blah.  I create simple scripts like this all the time to 
  rename batches of files, for example.  
 
  The easier way is probably just to not specify a dir to scp's remote 
  path though, since it defaults to the user's home directory.  
 
  Or, in anything resembling Bourne shell:
 
  varWithoutUsr=${varWithUsr#/usr}
 
 And I'll take a moment to recommend Matthew's method, since it does not
 involve fork()ing an additional process.
 
 When writing shell scripts in general, it's best if you can avoid
 spawning external processes for things which can be done easily
 (keyword: easily!) within Bourne natively.  There's no harm in doing it
 for more complex things, but fork() is somewhat expensive, and try to
 imagine what will happen to those scripts if the system lacks process
 table space, etc...  :-)  Best to try and make everything
 self-contained if possible.


right; esp'ly since i'll be running at least two scripts daily--
at a min.  besides, the simpler /bin/sh script is something i use
to save code or prose just in case the sky falls!

ah, no wonder this is the best list in the {known} universe

 
 -- 
 | Jeremy Chadwickjdc at parodius.com |
 | Parodius Networking   http://www.parodius.com/ |
 | UNIX Systems Administrator  Mountain View, CA, USA |
 | Making life hard for others since 1977.  PGP: 4BD6C0CB |
 

-- 
 Gary Kline  [EMAIL PROTECTED]  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


rsync or even scp questions....

2008-10-11 Thread Gary Kline
I have two desktop computers; three, if you count my new 
ThinkPad.  The TPad needs a new CAT5 cable, so for now I'm only
considereing the two tower computers.

On the Ubuntu computer I am /home/kline; on my main computer,
my home is /usr/home/kline.   The following sh script worked
perfected when my home on tao [FBSD] was /home/kline:

P
#!/bin/sh

PWD=`pwd`;
echo This directory is [${PWD}];

scp -qrp  ${PWD}/* ethos:/${PWD}
###/usr/bin/scp -rqp -i /home/kline/.ssh/zeropasswd-id ${PWD}/* \ klin
[EMAIL PROTECTED]:/${PWD}

Question #1: is there any /bin/sh method of getting rid of the
/usr?  I switch off between my two computers especially when
get mucked up, as with my upgrade to kde4.  (Otherwise, I do
backups of ~kline as well as other critical directories.)

Is there a way of automatically using rsync rather that my
kwik-and-dirty /bin/shell script?

thanks, people,

gary


PS: Complete disclosure: it works one way [tao to ethos] because
I have created a /usr/home/kline/* tree on ethos.   

PPS:  if this seems like a numbskull query, i only caught a few
  hours sleep last night!





-- 
 Gary Kline  [EMAIL PROTECTED]  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rsync or even scp questions....

2008-10-11 Thread mdh
--- On Sat, 10/11/08, Gary Kline [EMAIL PROTECTED] wrote:
   On the Ubuntu computer I am /home/kline; on my main
 computer,
   my home is /usr/home/kline.   The following sh script
 worked
   perfected when my home on tao [FBSD] was
 /home/kline:
 
 P
 #!/bin/sh
 
 PWD=`pwd`;
 echo This directory is [${PWD}];
 
 scp -qrp  ${PWD}/* ethos:/${PWD}
 ###/usr/bin/scp -rqp -i /home/kline/.ssh/zeropasswd-id
 ${PWD}/* \ klin
 [EMAIL PROTECTED]:/${PWD}
 
   Question #1: is there any /bin/sh method of getting rid of
 the
   /usr?  I switch off between my two computers
 especially when
   get mucked up, as with my upgrade to kde4.  (Otherwise, I
 do
   backups of ~kline as well as other critical directories.)
 
   Is there a way of automatically using rsync rather that my
   kwik-and-dirty /bin/shell script?
 
   thanks, people,
 
   gary

If what you wish to do is simply get rid of /usr in a string, you can use sed 
like so:
varWithoutUsr=`echo ${varWithUsr} |sed -e 's/\/usr//'`
After running this, where $varWithUsr is the variable containing a string like 
/usr/home/blah, the variable $varWithoutUsr will be equal to /home/blah.  I 
create simple scripts like this all the time to rename batches of files, for 
example.  

The easier way is probably just to not specify a dir to scp's remote path 
though, since it defaults to the user's home directory.  

- mdh



  
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]