zsh-users
 help / color / mirror / code / Atom feed
* tcsh -X behavior
@ 2000-10-13 15:29 Vincent Lefevre
  2000-10-13 16:08 ` Nemeth Ervin
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Lefevre @ 2000-10-13 15:29 UTC (permalink / raw)
  To: zsh-users

Could we have the tcsh -X behavior in zsh conditional expressions?

The tcsh manual says:

         X   Executable in the path or shell builtin, e.g.  ` - X
             ls'  and  ` - X  ls - F' are generally true, but `-X
             /bin/ls' is not (+)

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / PolKA research team at LORIA


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

* Re: tcsh -X behavior
  2000-10-13 15:29 tcsh -X behavior Vincent Lefevre
@ 2000-10-13 16:08 ` Nemeth Ervin
  2000-10-13 21:23   ` Vincent Lefevre
  0 siblings, 1 reply; 3+ messages in thread
From: Nemeth Ervin @ 2000-10-13 16:08 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: zsh-users

Vincent Lefevre <vincent@vinc17.org> writes:

> Could we have the tcsh -X behavior in zsh conditional expressions?
> 
> The tcsh manual says:
> 
>          X   Executable in the path or shell builtin, e.g.  ` - X
>              ls'  and  ` - X  ls - F' are generally true, but `-X
>              /bin/ls' is not (+)

You want probably the hash builtin:

     hash [ -dfmr ] [ name[=value] ] ...

[snip...]

          value.  For each  name  with  no  corresponding  value,
          search  for name in the path, and add it to the command
          hash table, and  associating  it  with  the  discovered
          path, if it is found.

So in a shell-script:

if hash ls 2> /dev/null; then
        :
fi

-- 
Ervin
						"Intelligenti pauca."


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

* Re: tcsh -X behavior
  2000-10-13 16:08 ` Nemeth Ervin
@ 2000-10-13 21:23   ` Vincent Lefevre
  0 siblings, 0 replies; 3+ messages in thread
From: Vincent Lefevre @ 2000-10-13 21:23 UTC (permalink / raw)
  To: zsh-users

On Fri, Oct 13, 2000 at 18:08:25 +0200, Nemeth Ervin wrote:
> So in a shell-script:
> 
> if hash ls 2> /dev/null; then
>         :
> fi

I currently use "whence >/dev/null" (it checks for aliases too, but this
is OK for me). What is the best one?

But IMHO, a -X operator would be a good idea.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / PolKA research team at LORIA


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

end of thread, other threads:[~2000-10-13 21:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-13 15:29 tcsh -X behavior Vincent Lefevre
2000-10-13 16:08 ` Nemeth Ervin
2000-10-13 21:23   ` Vincent Lefevre

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).