Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: returning a pathname from a function
- X-seq: zsh-workers 10347
- From: "Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: "Allen Belk" <allen.belk@xxxxxxx>, <zsh-workers@xxxxxxxxxxxxxx>
- Subject: RE: returning a pathname from a function
- Date: Fri, 31 Mar 2000 09:47:44 +0400
- Importance: Normal
- In-reply-to: <000501bf9a8a$6cd33a90$3e525f83@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
> prep_directories()
> {
> output_directory="/var/adm/backup/${1}_${2}"
> backup_log="${output_directory}/backup.log"
> backup_lis="${output_directory}/backup.lis"
> return $backup_log,$backup_lis
> }
>
> prep_directories 20000330 WEEKLY
>
>
> Executing this script results in the following error.
>
> prep_directories: bad math expression: unbalanced stack [75]
>
You cannot return string. return expects arithmetic expression as
status. I agree, that message is a bit weird ... what exact vesion do
you have?
What you try to do? Either output result using echo or print builtin:
print $backup_log,$backup_lis
in this case you can do something like
DIRS=$(prep_directories 20000330 WEEKLY)
or you can set parameter explicitly in function:
DIRS=$backup_log,$backup_lis
-andrej
Messages sorted by:
Reverse Date,
Date,
Thread,
Author