From owner-freebsd-questions@FreeBSD.ORG Sun Oct 12 04:00:58 2008 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB5171065686 for ; Sun, 12 Oct 2008 04:00:58 +0000 (UTC) (envelope-from mdh_lists@yahoo.com) Received: from web56801.mail.re3.yahoo.com (web56801.mail.re3.yahoo.com [66.196.97.75]) by mx1.freebsd.org (Postfix) with SMTP id 8A4188FC17 for ; Sun, 12 Oct 2008 04:00:58 +0000 (UTC) (envelope-from mdh_lists@yahoo.com) Received: (qmail 70386 invoked by uid 60001); 12 Oct 2008 04:00:58 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Message-ID; b=WBKclsIyxbu8jOPc7MfS4AjM+afCse0thMX/eZA0uaR5vD/j76quGcWija0FSH2dtyJGSHNOb+DzgyCYcSt+qMsIy7i9rP/uRWN8BEF/YF7xvB2xRd04+L40R7Q238vq03R6317VIUeGeC9HTMmfD/SU+rIpU0YCa66PJwo5TVs=; X-YMail-OSG: EZAH7TEVM1lWSdXiUaj3AhuzPDi2SBDb3O2sYnNzcta3.dsHiqYiiAr7zf1fy4XfGcbdvSo_zJ.2SV4TO91u62.GfNHBGmhKkaZaHZPhLo26vWKEGS3fcdIpT1z9KCcP9V6MUpA_P58Afj0QhqtSk9j41Finqd7h4of48QFEfV_BsQSDiaqeL69e90RIZQ-- Received: from [71.61.220.126] by web56801.mail.re3.yahoo.com via HTTP; Sat, 11 Oct 2008 21:00:57 PDT X-Mailer: YahooMailWebService/0.7.218.2 Date: Sat, 11 Oct 2008 21:00:57 -0700 (PDT) From: mdh To: FreeBSD Mailing List , Gary Kline In-Reply-To: <20081011234612.GA5515@thought.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <7708.70177.qm@web56801.mail.re3.yahoo.com> Cc: Subject: Re: rsync or even scp questions.... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: mdh_lists@yahoo.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 04:00:58 -0000 --- On Sat, 10/11/08, Gary Kline 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@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. - mdh