You are not logged in.

#1 2008-11-13 01:33:45

hack.augusto
Member
From: Brazil
Registered: 2008-08-28
Posts: 124

zsh exporting variables

I have a function inside a while loop, and this function needs use a value from the last run. I tried to export it, but it isn't working.
Doing some testing I found that this exports the variable:

func(){
  export var=`date +%N`
}

while :; do
  func
  echo $var
done

but how I used doesn't:

func(){
  echo $var
  export var=`date +%N`
}

while :; do
  echo `func`
done

How could I use the second sintax and export the variable?

Last edited by hack.augusto (2008-11-13 01:34:39)

Offline

#2 2008-11-16 15:04:19

hack.augusto
Member
From: Brazil
Registered: 2008-08-28
Posts: 124

Re: zsh exporting variables

I just want the variable at the script scope, but declare it in the script scope isn't working also.

Offline

Board footer

Powered by FluxBB