Re: rsync or even scp questions....



On Sun, Oct 12, 2008 at 09:42:38AM +0100, Matthew Seaman wrote:
mdh wrote:
--- On Sat, 10/11/08, Gary Kline <kline@xxxxxxxxxxx> 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.

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 kline@xxxxxxxxxxx http://www.thought.org Public Service Unix
http://jottings.thought.org http://transfinite.thought.org


_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: How to rewrite with awk?
    ... > I'm unfamiliar with tools such as sed & awk. ... Extract the string that matches a RE. ... This script will not only expand all the lines that say "include ... file) and not resetting ARGV(the tmp file), it then lets awk do any ...
    (comp.unix.shell)
  • Re: Slow string
    ... I see virtually no difference in execution time for the code you posted when using cscript versus using wscript; to confirm, I bracketed the code with an initial ... Are you actually entering the script name into a console window? ... You can use the exact same line for every wrapper script - and that includes wsf and js scripts; all you need to do is change the final "vbs" to "wsf" or "js" as appropriate. ... If you build a large string by small concatenations, the performance degrades geometrically - so does array resizing, because they both use the same nasty technique inherited from VB1 of copying the entire data structure to a new structure with the added element. ...
    (microsoft.public.scripting.vbscript)
  • Re: Function that returns date of file.
    ... string after the date/time when it is used by itself. ... Is that your entire script? ... I make an IF statement that required the 'equals equals'. ... designed database your job will be all that much harder. ...
    (alt.php)
  • Multiple vulnerabilities found in CSGuestbook by CoolSerlets.com
    ... About this script: This is an open source GuestBook script offered by CoolServlets.com ... About the audit: This audit was performed by Daxgrapol and Dopel for RACAT. ... Only the first special character is filtered off of the return string. ... - Buffer overflow is possible (input field length not checked). ...
    (Bugtraq)
  • Re: Script: Remote shutdown of all domain computers
    ... When trying to run the script from a XP workstation, where i am logged in as ... Dim strBase, strFilter, strAttributes, strQuery, objRecordSet ... 2000 or above and allow shutdown, ... Public Function AllComputersAs String() ...
    (microsoft.public.windows.server.scripting)