rsync or even scp questions....

Matthew Seaman m.seaman at infracaninophile.co.uk
Sun Oct 12 08:42:58 UTC 2008


mdh wrote:
> --- On Sat, 10/11/08, Gary Kline <kline at thought.org> 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
>> e at ethos:/${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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20081012/a0d3a70f/signature.pgp


More information about the freebsd-questions mailing list