* Second form of cd.
@ 1999-04-13 20:32 Larry P. Schrof
1999-04-13 21:07 ` Sweth Chandramouli
0 siblings, 1 reply; 3+ messages in thread
From: Larry P. Schrof @ 1999-04-13 20:32 UTC (permalink / raw)
To: zsh-users
I am wondering if this an intentional feature or a bug. I am running
3.1.5...
When you type 'cd <old> <new>' on the command line, zsh replaces
only the FIRST occurance of <old> in the directory. I've actually run
into situations where <old> occurs more than once in $PWD, and I'd
like <new> to replace this second occurance of old.
I am requesting that <new> replace ALL occurances of <old> in $PWD, not
just the first one.
Thanks.
- Larry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Second form of cd.
1999-04-13 20:32 Second form of cd Larry P. Schrof
@ 1999-04-13 21:07 ` Sweth Chandramouli
1999-04-14 16:02 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Sweth Chandramouli @ 1999-04-13 21:07 UTC (permalink / raw)
To: zsh-users
On Tue, Apr 13, 1999 at 03:32:20PM -0500, Larry P. Schrof wrote:
> I am wondering if this an intentional feature or a bug. I am running
> 3.1.5...
>
> When you type 'cd <old> <new>' on the command line, zsh replaces
> only the FIRST occurance of <old> in the directory. I've actually run
> into situations where <old> occurs more than once in $PWD, and I'd
> like <new> to replace this second occurance of old.
>
> I am requesting that <new> replace ALL occurances of <old> in $PWD, not
> just the first one.
along the same lines, the ^old^new form of history substitution
replaces just the first instance of old. perhaps a flag of some sort
(cd -g, maybe, for cd, and ^^old^new for history substitution?) could be
added to indicate that global replacement should occur?
-- sweth.
--
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Second form of cd.
1999-04-13 21:07 ` Sweth Chandramouli
@ 1999-04-14 16:02 ` Bart Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1999-04-14 16:02 UTC (permalink / raw)
To: zsh-users
On Apr 13, 3:32pm, Larry P. Schrof wrote:
} Subject: Second form of cd.
}
} I am wondering if this an intentional feature or a bug. I am running
} 3.1.5...
It's the intended behavior. Interpret that as you will.
} When you type 'cd <old> <new>' on the command line, zsh replaces
} only the FIRST occurance of <old> in the directory. I've actually run
} into situations where <old> occurs more than once in $PWD, and I'd
} like <new> to replace this second occurance of old.
The way I usually deal with this is to disambiguate the replacement
string somehow. E.g. suppose the two directories are
~/src/package/src/subdir/
~/src/package/build/subdir/
"cd src build" attempts to change to ~/build/package/src/subdir/, which
doesn't exist. So instead I type something like
cd src/s build/s
to force the match on the correct substring.
} I am requesting that <new> replace ALL occurances of <old> in $PWD, not
} just the first one.
That would, in many cases, be equally wrong. The best solution for this
is
cd $PWD:gs/new/old
On Apr 13, 5:07pm, Sweth Chandramouli wrote:
} Subject: Re: Second form of cd.
}
} along the same lines, the ^old^new form of history substitution
} replaces just the first instance of old. perhaps a flag of some sort
} (cd -g, maybe, for cd, and ^^old^new for history substitution?) could be
} added to indicate that global replacement should occur?
What's wrong with !!:gs/old/new ? Horrors, four whole extra characters?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-04-14 16:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-13 20:32 Second form of cd Larry P. Schrof
1999-04-13 21:07 ` Sweth Chandramouli
1999-04-14 16:02 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).