in reply to Any idea how to pass a variable there ?

> Where it says '/dev/ttyS1' i need to put a $variable, but it doesnt read the variable

Thats impossible!¹

Your problem is somewhere else, but w/o showing us more we can't tell a lot!

Cheers Rolf

( addicted to the Perl Programming Language)

update

¹) But davido's guess is not bad! =)