Hi everybody!
I’m trying to do this:
#!/bin/ksh
file1="/home/myfile.txt"
set -i z=1
tmp=“file$z”
echo $tmp
out: file1
I want that the echo return me “/home/myfile.txt”, not “file1”
Is this possible?
Thanks!
Hi everybody!
I’m trying to do this:
#!/bin/ksh
file1="/home/myfile.txt"
set -i z=1
tmp=“file$z”
echo $tmp
out: file1
I want that the echo return me “/home/myfile.txt”, not “file1”
Is this possible?
Thanks!
why don´t you do it like this:
#! /bin/sh
file[1]=/home/myfile.txt
file[2]=/home/myfile2.txt
file[3]=/tmp/anotheroneofmyfilesbutthistimeintmp.txt
z=1
tmp=${file[$z]}
echo $tmp
In qnx6 works fine, but i’m using qnx4.25…
this is also possible in QNX4.25 by:
#!/bin/sh
file1=/home/myfile.txt
file2=/home/yourfile.txt
file3=/tmp/anotherfilebutthistimeintmp.txt
myfilenumber=1
mytmp=file$myfilenumber
eval mytmp=$$mytmp
echo $mytmp
Thanks! works fine.