Date: Sun, 12 Oct 2008 09:42:38 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: mdh_lists@yahoo.com Cc: Gary Kline <kline@thought.org>, FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: rsync or even scp questions.... Message-ID: <48F1B87E.6010803@infracaninophile.co.uk> In-Reply-To: <7708.70177.qm@web56801.mail.re3.yahoo.com> References: <7708.70177.qm@web56801.mail.re3.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF7F2052B3717C3B67B75BF41 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable mdh wrote: > --- On Sat, 10/11/08, Gary Kline <kline@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=3D`pwd`; >> echo "This directory is [${PWD}]"; >> >> scp -qrp ${PWD}/* ethos:/${PWD} >> ###/usr/bin/scp -rqp -i /home/kline/.ssh/zeropasswd-id >> ${PWD}/* \ klin >> e@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 >=20 > If what you wish to do is simply get rid of /usr in a string, you can u= se sed like so: > varWithoutUsr=3D`echo ${varWithUsr} |sed -e 's/\/usr//'` > After running this, where $varWithUsr is the variable containing a stri= ng like "/usr/home/blah", the variable $varWithoutUsr will be equal to "/= home/blah". I create simple scripts like this all the time to rename bat= ches of files, for example. =20 >=20 > The easier way is probably just to not specify a dir to scp's remote pa= th though, since it defaults to the user's home directory. =20 Or, in anything resembling Bourne shell: varWithoutUsr=3D${varWithUsr#/usr} Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigF7F2052B3717C3B67B75BF41 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkjxuIkACgkQ8Mjk52CukIxuVQCgkJ27dRDE1MRfa9WYgRuqbHjq tfwAni/rEu/wvVPC0Y12l77Y6FuD2Dmz =Vuiw -----END PGP SIGNATURE----- --------------enigF7F2052B3717C3B67B75BF41--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48F1B87E.6010803>