looking for some help here. I am seeing the below issue
y=1
j$y=`cat /home/devteam/auppu/new_ig_1|head -n $y`
ksh: j1=5555555555555555: not found
i have no issue when i cat on the file,like below
cat /home/devteam/auppu/new_ig_1|head -n $y
5555555555555555
You might have to do something like
y=1
x=j${y}
x=`cat /home/devteam/auppu/new_ig_1|head -n $y`
echo $x
You would need to create an intermediate variable (x in this case) and then assign to it the results of your cat
command
The simplest way to do this is using an indexed array, like so:
y=1
j[$y]=`cat /home/devteam/auppu/new_ig_1|head -n $y`
echo ${j[$y]}
This way you can store multiple invocations of the cat
command in your loop into the associative array referenced by the j
variable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.