zsh-users
 help / color / mirror / code / Atom feed
* Using 'command -v' in a shellscript results in a coredump
@ 2004-08-18 23:29 Michael Prokop
  2004-08-19  7:11 ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Prokop @ 2004-08-18 23:29 UTC (permalink / raw)
  To: zsh-users

Hello,

on my system /bin/sh is a symlink to /bin/zsh4 (version 4.2.1).

I noticed a strange behaviour with the following shellscript:

#!/bin/sh
set -e
command -v blub > /dev/null 2>&1

Running it results in 'zsh: segmentation fault (core dumped)'.
Running the script with /bin/sh pointing to /bin/bash does not
produce a core dump.

Regarding to the zsh-manual 'command' is defined as:

 ,---- [ man zsh ]
 | command [ -pvV ] simple command
 |
 |  The  simple  command argument is taken as an external command
 |  instead of a function or builtin and is executed. If the
 |  POSIX_BUILTINS option is set, builtins will also be executed but
 |  cer- tain  special  properties  of  them are  suppressed.  The -p
 |  flag causes a default path to be searched instead of that in
 |  $path. With the -v flag, command is similar to whence and with -V,
 |  it is equivalent to whence -v.
 `----

Regarding to "IEEE Std 1003.1-2001, Section 12.2, Utility Syntax
Guidelines" 'command -v' is defined as:

 ,---- [ command -v ]
 | -v
 | (On systems supporting the User Portability Utilities option.) Write
 | a string to standard output that indicates the pathname or command
 | that will be used by the shell, in the current shell execution
 | environment (see Shell Execution Environment ), to invoke
 | command_name, but do not invoke command_name.
 `----

I'm not sure whether it's a bug in the shellscript (use of
non-sh-code) or the behaviour of zsh in sh-mode isn't correct.
Could anyone please explain me what's going on?

Thanks && regards,
(-: Michael
-- 
www.michael-prokop.at
~
~
".signature" [New] 1L, 22C [w]


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

end of thread, other threads:[~2004-10-13 22:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-18 23:29 Using 'command -v' in a shellscript results in a coredump Michael Prokop
2004-08-19  7:11 ` Bart Schaefer
2004-10-07 17:55   ` Michael Prokop
2004-10-08 13:53     ` Clint Adams
2004-10-09 20:50       ` simple question about completion and case William Scott
2004-10-11 22:31         ` Bart Schaefer
2004-10-11 22:29     ` Using 'command -v' in a shellscript results in a coredump Bart Schaefer
2004-10-13 22:09       ` Michael Prokop

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