I am doing a sh shell script , But I dont have any idea how to read value from user Keyboard and store them to an array .. Is it possible or not I am not also sure in sh shell script ?
EX:-
#! /bin/sh
if my input line is - 300 200 100. Then it should display
DATA[1] -300
DATA[2] -200
DATA[3] -100
If it can be store in array then is $# will give me total no of array or anything else ?
or The only way to store is
read DATA[1] DATA[2] DATA[3] in sh script ?
echo 'enter a line'
set userline = $<
echo $userline
set uline = ($userline)
echo $uline[1]
echo $uline[2]
echo $uline[3]
echo $uline[4]
If We enter 20 10 30 70
and I guess $# will give me total no index in that array..
Then it ll display
20
10
30
70
like this I want in sh shell script not in awk or nawk . I am not sure it is possible or not ?
Hope this time my explanation is better than before