Pass a variable as an agruement for cut
I want to pass a variable as an arguement in a cut statement.
Here is basically what I want to do
Opt=3
Optlist="banana apple orange grape"
optsel=`echo $Optlist | cut -d " " -f $Opt`
I want to cut the third field, or what ever Opt is set to at the time, from optsel.
The problem is putting $Opt after -f doesn't work nor does "$Opt", '$Opt'
Can anyone help me.
|