![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AWK set FILENAME via user input | timj123 | Shell Programming and Scripting | 2 | 02-24-2008 03:05 PM |
| awk user input | gefa | Shell Programming and Scripting | 17 | 10-30-2007 05:01 AM |
| Accepting user input in c shell | skumar11 | Shell Programming and Scripting | 3 | 09-09-2007 06:32 PM |
| Accepting user input in Bourne shell and using sed | Pits | Shell Programming and Scripting | 1 | 09-09-2007 09:39 AM |
| Getting user input | stevefox | Shell Programming and Scripting | 3 | 02-16-2007 02:09 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Dear Friends,
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 read DATA echo "DATA[1] -" $DATA[1] echo "DATA[3] -" $DATA[2] echo "DATA[3] -" $DATA[3] 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 ? I need a drop of Knowledge from you friends.. Thanks in advance. user_prady Last edited by user_prady; 11-14-2007 at 02:18 AM.. |
|
||||
|
Quote:
But I think you did not get my problem.. Anyway Thanks for the reply Like in csh shell script #!/bin/csh -f 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 Thanks again user_pradyu |
|
||||
|
sh does not have support for arrays but ksh does.
|
|
||||
|
Quote:
Thaaaaaaaaaaak You ..............Love the people out here.. ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|