Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #165235
| From | Jude DaShiell <jdashiel@panix.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: cd as much as possible |
| Date | 2016-03-11 13:10 +0100 |
| Message-ID | <rbu3g-64t-3@gated-at.bofh.it> (permalink) |
| References | <rb1ui-2rw-11@gated-at.bofh.it> <rb334-3w5-21@gated-at.bofh.it> <rbmfo-bV-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 10 Mar 2016, kamaraju kusumanchi wrote:
> Date: Thu, 10 Mar 2016 22:45:09
> From: kamaraju kusumanchi <raju.mailinglists@gmail.com>
> To: "debian-user@lists.debian.org" <debian-user@lists.debian.org>,
> tlikonen@iki.fi
> Subject: Re: cd as much as possible
> Resent-Date: Fri, 11 Mar 2016 03:45:45 +0000 (UTC)
> Resent-From: debian-user@lists.debian.org
>
> On Thu, Mar 10, 2016 at 2:11 AM, Teemu Likonen <tlikonen@iki.fi> wrote:
>>
>> I don't know about zsh but here's a sh/bash function:
>>
>> mycd() {
>> local dir=$1
>> while ! cd -- "$dir"; do
>> dir=$(dirname -- "$dir")
>> done
>> }
>>
>
> This is exactly what I wanted. Thanks. It works in zsh too.
>
> raju
>
The find command probably can handle this maybe in a shorter form. I
don't know as much syntax of that command as I'd like otherwise this could
probably written in a single line of code.
--
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
cd as much as possible kamaraju kusumanchi <raju.mailinglists@gmail.com> - 2016-03-10 06:40 +0100
Re: cd as much as possible Teemu Likonen <tlikonen@iki.fi> - 2016-03-10 08:20 +0100
Re: cd as much as possible kamaraju kusumanchi <raju.mailinglists@gmail.com> - 2016-03-11 04:50 +0100
Re: cd as much as possible Jude DaShiell <jdashiel@panix.com> - 2016-03-11 13:10 +0100
Re: cd as much as possible Teemu Likonen <tlikonen@iki.fi> - 2016-03-11 13:30 +0100
Re: cd as much as possible kamaraju kusumanchi <raju.mailinglists@gmail.com> - 2016-03-11 05:10 +0100
Re: cd as much as possible Jens Bauer <jens-lists@gpio.dk> - 2016-03-16 03:10 +0100
Re: cd as much as possible kamaraju kusumanchi <raju.mailinglists@gmail.com> - 2016-03-18 05:20 +0100
csiph-web