Hello
If anybody knows something about the following please help me.
I am using HP unix.
In a script called test.txt i have the following command
echo ok | tee test1.txt
It works fine.It prints ok on the screen and creates the file test1.txt and puts in the file the "ok".
In the same script i want to do the following.Instead of the command
echo ok | tee test1.txt , i want to use :
myvariable=| tee test1.txt
echo ok $myvariable
But the above does not work correct.It prints ok on the screen and creates the file test1.txt .But the file test1.txt is emtpy(zero bytes).
I have tried the following commands but none worked for me.
myvariable
#1
myvariable='| tee test1.txt'
echo ok $myvariable
#2
myvariable=| tee test1.txt
echo "ok $myvariable"
#3
myvariable='| tee test1.txt'
echo "ok $myvariable"
#4
myvariable=| tee test1.txt
echo "ok ${myvariable}"
#5
myvariable='| tee test1.txt'
echo "ok ${myvariable}"
#6
myvariable="| tee test1.txt"
echo "ok ${myvariable}"
#7
myvariable=| tee test1.txt
eval echo ok \${$myvariable}
#8
myvariable="| tee test1.txt"
eval echo ok \${$myvariable}
Thank you for your time.