zsh-users
 help / color / mirror / code / Atom feed
* (-) doesn't make (e) working on the files which symbolic links point to ?
@ 2014-10-24  2:14 Han Pingtian
  2014-10-24  3:22 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Han Pingtian @ 2014-10-24  2:14 UTC (permalink / raw)
  To: zsh-user

Hi,

Looks like the qualifer "(-)" doesn't make "(e)" works on files pointed
by symblic, on linux:

% ls -l /dev/disk/by-id/*(-e'.[[ $REPLY = *sda* ]].')
zsh: no match
% ls -l /dev/disk/by-id/*(-e'.[[ $(readlink $REPLY) = *sda* ]].')
lrwxrwxrwx. 1 root root  9 Oct 23 18:34 /dev/disk/by-id/ata-HITACHI_HTS727550A9E364_J3320082GD0NWB -> ../../sda
lrwxrwxrwx. 1 root root 10 Oct 23 18:34 /dev/disk/by-id/ata-HITACHI_HTS727550A9E364_J3320082GD0NWB-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Oct 23 18:34 /dev/disk/by-id/ata-HITACHI_HTS727550A9E364_J3320082GD0NWB-part2 -> ../../sda2
lrwxrwxrwx. 1 root root 10 Oct 23 18:34 /dev/disk/by-id/ata-HITACHI_HTS727550A9E364_J3320082GD0NWB-part3 -> ../../sda3
lrwxrwxrwx. 1 root root  9 Oct 23 18:34 /dev/disk/by-id/wwn-0x5000cca68ac576fb -> ../../sda
lrwxrwxrwx. 1 root root 10 Oct 23 18:34 /dev/disk/by-id/wwn-0x5000cca68ac576fb-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Oct 23 18:34 /dev/disk/by-id/wwn-0x5000cca68ac576fb-part2 -> ../../sda2
lrwxrwxrwx. 1 root root 10 Oct 23 18:34 /dev/disk/by-id/wwn-0x5000cca68ac576fb-part3 -> ../../sda3
%

it would be better if "$REPLY" contains name of the file pointed by
symblic there :)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (-) doesn't make (e) working on the files which symbolic links point to ?
  2014-10-24  2:14 (-) doesn't make (e) working on the files which symbolic links point to ? Han Pingtian
@ 2014-10-24  3:22 ` Bart Schaefer
  2014-10-24  6:28   ` Han Pingtian
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2014-10-24  3:22 UTC (permalink / raw)
  To: zsh-user

On Oct 24, 10:14am, Han Pingtian wrote:
} 
} Looks like the qualifer "(-)" doesn't make "(e)" works on files pointed
} by symblic

The only thing that (-) controls is whether the file attributes are read
by lstat() or stat().  It does not cause a readlink(); note that even in
the absence of (e), the names returned by *(@-) are the names of the links
and not of the files linked-to.

You want (:A) like so:

    ls -l /dev/disk/by-id/*(:Ae'.[[ $REPLY = *sda* ]].')


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (-) doesn't make (e) working on the files which symbolic links point to ?
  2014-10-24  3:22 ` Bart Schaefer
@ 2014-10-24  6:28   ` Han Pingtian
  2014-10-24  7:05     ` Mikael Magnusson
  2014-10-24  7:19     ` Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Han Pingtian @ 2014-10-24  6:28 UTC (permalink / raw)
  To: zsh-users

On Thu, Oct 23, 2014 at 08:22:53PM -0700, Bart Schaefer wrote:
> On Oct 24, 10:14am, Han Pingtian wrote:
> } 
> } Looks like the qualifer "(-)" doesn't make "(e)" works on files pointed
> } by symblic
> 
> The only thing that (-) controls is whether the file attributes are read
> by lstat() or stat().  It does not cause a readlink(); note that even in
> the absence of (e), the names returned by *(@-) are the names of the links
> and not of the files linked-to.
> 

Thanks.

> You want (:A) like so:
> 
>     ls -l /dev/disk/by-id/*(:Ae'.[[ $REPLY = *sda* ]].')

I'm sorry, it doesn't work. The outputs of "*(:Ae'.[[ $REPLY = *sda* ]].')"
is the same as "*(:A)".


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (-) doesn't make (e) working on the files which symbolic links point to ?
  2014-10-24  6:28   ` Han Pingtian
@ 2014-10-24  7:05     ` Mikael Magnusson
  2014-10-24  8:56       ` Han Pingtian
  2014-10-24  7:19     ` Bart Schaefer
  1 sibling, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2014-10-24  7:05 UTC (permalink / raw)
  To: Zsh Users

On Fri, Oct 24, 2014 at 8:28 AM, Han Pingtian <hanpt@linux.vnet.ibm.com> wrote:
> On Thu, Oct 23, 2014 at 08:22:53PM -0700, Bart Schaefer wrote:
>> On Oct 24, 10:14am, Han Pingtian wrote:
>> }
>> } Looks like the qualifer "(-)" doesn't make "(e)" works on files pointed
>> } by symblic
>>
>> The only thing that (-) controls is whether the file attributes are read
>> by lstat() or stat().  It does not cause a readlink(); note that even in
>> the absence of (e), the names returned by *(@-) are the names of the links
>> and not of the files linked-to.
>>
>
> Thanks.
>
>> You want (:A) like so:
>>
>>     ls -l /dev/disk/by-id/*(:Ae'.[[ $REPLY = *sda* ]].')
>
> I'm sorry, it doesn't work. The outputs of "*(:Ae'.[[ $REPLY = *sda* ]].')"
> is the same as "*(:A)".
>

It would appear that :A causes the e to not execute at all, but in
either case the end result would not be the desired one. The following
works, if your zsh is new enough to allow globbing in this context.
ls -l /dev/disk/by-id/*(e.'[[ $REPLY(#q:A) = *sda* ]]'.)

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (-) doesn't make (e) working on the files which symbolic links point to ?
  2014-10-24  6:28   ` Han Pingtian
  2014-10-24  7:05     ` Mikael Magnusson
@ 2014-10-24  7:19     ` Bart Schaefer
  1 sibling, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2014-10-24  7:19 UTC (permalink / raw)
  To: zsh-users

On Oct 24,  2:28pm, Han Pingtian wrote:
}
} > You want (:A) like so:
} > 
} >     ls -l /dev/disk/by-id/*(:Ae'.[[ $REPLY = *sda* ]].')
} 
} I'm sorry, it doesn't work. The outputs of "*(:Ae'.[[ $REPLY = *sda* ]].')"
} is the same as "*(:A)".

Hmm, you're correct, I was fooled by the way I was testing it.  There
does not seem to be a way to get $REPLY to be passed in as the target
of the link.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (-) doesn't make (e) working on the files which symbolic links point to ?
  2014-10-24  7:05     ` Mikael Magnusson
@ 2014-10-24  8:56       ` Han Pingtian
  0 siblings, 0 replies; 6+ messages in thread
From: Han Pingtian @ 2014-10-24  8:56 UTC (permalink / raw)
  To: zsh-users

On Fri, Oct 24, 2014 at 09:05:23AM +0200, Mikael Magnusson wrote:
> It would appear that :A causes the e to not execute at all, but in
> either case the end result would not be the desired one. The following
> works, if your zsh is new enough to allow globbing in this context.
> ls -l /dev/disk/by-id/*(e.'[[ $REPLY(#q:A) = *sda* ]]'.)
> 
Thanks. And this one also works:

ls -l /dev/disk/by-id/*(e.'[[ ${REPLY:A} = *sda* ]]'.)



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-10-24  9:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-24  2:14 (-) doesn't make (e) working on the files which symbolic links point to ? Han Pingtian
2014-10-24  3:22 ` Bart Schaefer
2014-10-24  6:28   ` Han Pingtian
2014-10-24  7:05     ` Mikael Magnusson
2014-10-24  8:56       ` Han Pingtian
2014-10-24  7:19     ` 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).