Outputting last value of a fix / Invalid fix ID in variable formula


I'm not very at ease with the script syntax, to say the least :slight_smile:
I'd like to do something that sounds trivial but I don't manage to.

During an NPT run I'm doing a running average of box size with:
fix 5 all ave/time 100 1 100 lx start ${avg_starttime} ave running

Now I want to output the last value of this fix. So I tried:
variable foo equal f_5
fix 6 all print \{timelength\} {foo}

but get the following error: "Invalid fix ID in variable formula". Double quoting "${foo}" just delays the error to step 200. Removing the start keyword in fix 5 does not solve the issue.

My Lammps version is 30 Sep 2013.

Here is the complete script:
variable timelength equal 200
variable thermo_step equal 100
variable avg_starttime equal ${timelength}/2

units metal
atom_style atomic

read_data data.CuZr256_NPT
velocity all create 1500 42

group Cu type 1
group Zr type 2

pair_style sw
pair_coeff * * CuZr.sw Cu Zr

neighbor 2.0 bin
neigh_modify every 1

fix 1 all npt temp 1500 1500 0.1 iso 1.0 1.0 1 drag 0.5
timestep 0.0010

thermo_style custom step temp pe etotal press vol lx
thermo ${thermo_step}

fix 5 all ave/time 100 1 100 lx start ${avg_starttime} ave running

variable foo equal f_5
#fix 6 all print \{timelength\} "{foo}"
fix 6 all print \{timelength\} {foo}

dump 3 all custom ${timelength} config_*.snap id type x y z vx vy vz

run ${timelength}

Thanks for your help.