zsh-users
 help / color / mirror / code / Atom feed
* $0 in function
@ 2001-10-01  5:00 Joakim Ryden
  2001-10-01  5:05 ` Sweth Chandramouli
  2001-10-01  5:09 ` Phil Pennock
  0 siblings, 2 replies; 6+ messages in thread
From: Joakim Ryden @ 2001-10-01  5:00 UTC (permalink / raw)
  To: zsh-users

I have a simple catch-all error function like so:

function print_error() {

        echo "$0: an error ocurred"
        echo -e "check buildlog: $BUILD_LOG for more information\n"
        exit 1
}

In bash this prints on error:
./build_apache: an error ocurred.
check buildlog: /home/jo/www/build.log for more information
In zsh it prints:
print_error: an error ocurred. 
check buildlog: /home/jo/www/build.log for more information

Is there an option I need to (un)set to emulate the bash behaviour in
this instance?

Thanks!
Jo


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

* Re: $0 in function
  2001-10-01  5:00 $0 in function Joakim Ryden
@ 2001-10-01  5:05 ` Sweth Chandramouli
  2001-10-01  5:09 ` Phil Pennock
  1 sibling, 0 replies; 6+ messages in thread
From: Sweth Chandramouli @ 2001-10-01  5:05 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

On Mon, Oct 01, 2001 at 01:00:06AM -0400, Joakim Ryden wrote:
> Is there an option I need to (un)set to emulate the bash behaviour in
> this instance?
$ setopt function_argzero.

	-- Sweth.

-- 
Sweth Chandramouli ; <svc@sweth.net>
President, Idiopathic Systems Consulting

[-- Attachment #2: Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: $0 in function
  2001-10-01  5:00 $0 in function Joakim Ryden
  2001-10-01  5:05 ` Sweth Chandramouli
@ 2001-10-01  5:09 ` Phil Pennock
  1 sibling, 0 replies; 6+ messages in thread
From: Phil Pennock @ 2001-10-01  5:09 UTC (permalink / raw)
  To: Joakim Ryden; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 811 bytes --]

On 2001-10-01 at 01:00 -0400, Joakim Ryden wrote:
> Is there an option I need to (un)set to emulate the bash behaviour in
> this instance?

You're looking to modify the behaviour of a parameter.  So look at the
docs for that parameter ...

$ man zshparam
[...]
       0 <S>  The  name used to invoke the current shell.  If the
              FUNCTION_ARGZERO option is set, this  is  set  tem­
              porarily within a shell function to the name of the
              function, and within a sourced script to  the  name
              of the script.

-- 
If you're getting loose spam, then I suggest you reply with some Lomotil or
KaoPectate.  Loose spam is a terrible thing to deal with, requiring gloves and
lots of soap, water, paper towels, and biohazard bags. -- Mike Andrews, NANAE

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

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

* RE: $0 in function
@ 2001-10-01  5:38 Joakim Ryden
  0 siblings, 0 replies; 6+ messages in thread
From: Joakim Ryden @ 2001-10-01  5:38 UTC (permalink / raw)
  To: Sweth Chandramouli, zsh-users

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

Thanks Sweth - nevermind, it helps to have your terminal windows
straight at 1:30 in the am - it's all good. :)

--Jo


-----Original Message-----
From:	Sweth Chandramouli
Sent:	Mon 10/1/2001 1:34 AM
To:	zsh-users@sunsite.dk
Cc:	
Subject:	Re: $0 in function



[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 2155 bytes --]

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

* Re: $0 in function
  2001-10-01  5:25 Joakim Ryden
@ 2001-10-01  5:34 ` Sweth Chandramouli
  0 siblings, 0 replies; 6+ messages in thread
From: Sweth Chandramouli @ 2001-10-01  5:34 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

On Mon, Oct 01, 2001 at 01:25:55AM -0400, Joakim Ryden wrote:
> Hmm, thanks. Is function_argzero supposed to show up in the setopt list?
	Unless you have the option kshoptionprint set, setopt
only shows options that have changed from their default value.  The
default for function_argzero is on, so you would normally only see it
in setopt's output as nofunctionargzero, when you disable it.
	What do you get after a
$ setopt nofunctionargzero
	?

	-- Sweth.

-- 
Sweth Chandramouli ; <svc@sweth.net>
President, Idiopathic Systems Consulting

[-- Attachment #2: Type: application/pgp-signature, Size: 236 bytes --]

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

* RE: $0 in function
@ 2001-10-01  5:25 Joakim Ryden
  2001-10-01  5:34 ` Sweth Chandramouli
  0 siblings, 1 reply; 6+ messages in thread
From: Joakim Ryden @ 2001-10-01  5:25 UTC (permalink / raw)
  To: Phil Pennock; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

Hmm, thanks. Is function_argzero supposed to show up in the setopt list?

% setopt
interactive
monitor
shinstdin
zle
% setopt function_argzero
% setopt
interactive
monitor
shinstdin
zle

(and the function still prints the same thing as before)

--Jo


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 2187 bytes --]

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

end of thread, other threads:[~2001-10-01  5:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-01  5:00 $0 in function Joakim Ryden
2001-10-01  5:05 ` Sweth Chandramouli
2001-10-01  5:09 ` Phil Pennock
2001-10-01  5:25 Joakim Ryden
2001-10-01  5:34 ` Sweth Chandramouli
2001-10-01  5:38 Joakim Ryden

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