Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: copying to a deep parallel directory



In the last episode (Nov 06), Peter Stephenson said:
> On Wed, 06 Nov 2013 17:21:23 +0000 (UTC)
> zzapper <david@xxxxxxxxxxxxxx> wrote:
> > Say I want to copy a file from
> > 
> > /var/www/html/admin/include/
> > 
> > to
> > 
> > /var/www/live/admin/include/
> > 
> > I can of course
> > 
> > cd html live
> > 
> > and then I can use $OLDPWD or ~+1
> > 
> > but is there anything niftier?
> 
> So we're assuming you're in the former directory...
> 
> cp <file> ${PWD/html/live}
> 
> This syntax gets a bit messy if you're changing multiple levels
> since you need to quote the slashes.

I use brace expansion a lot for things like this.

cp /var/www/{html,live}/admin/include/file.html

-- 
	Dan Nelson
	dnelson@xxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author