Sponsored Content
Top Forums Shell Programming and Scripting sh shell user input and stote it to a array Post 302145420 by fpmurphy on Wednesday 14th of November 2007 05:44:11 AM
Old 11-14-2007
OK, here is an example.

#!/bin/ksh

set -A parms $*
print "You supplied ${#parms[@]} parameters:"

echo 'Enter a line'
read x
echo 'You entered this line: ' $x
set -A rarray $x
print "You entered ${#rarray[@]} items"
print ${rarray[0]}
print ${rarray[1]}
print ${rarray[2]}
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Accepting user input in c shell

i need to accept the user input in my c shell script before executing next command. i have the following code which ask for user input, but does not store this value. set req echo " Enter your input(Y/N)?" read req if (req = Y) echo " print $req" else echo " print $req" ... (3 Replies)
Discussion started by: skumar11
3 Replies

2. UNIX for Dummies Questions & Answers

How to display values from user input array?

Hi all, I wrote a script that reads inputs from user and store in array named "input". The number of elements in the array is not fixed - determined only after user exit the while loop that reads the array values : x=1 echo "Enter first value" read input while } != "exit" ] do ... (1 Reply)
Discussion started by: luna_soleil
1 Replies

3. Programming

How to pass C array as input to Shell script

Hi, In the below C code , i want to pass the array to a unix shel script. my script should called as ex myscript 1,2,3 #include <stdio.h> int main() { int a={1,2,3}; } Thanks, Arun (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

4. Shell Programming and Scripting

User Input Shell Script

Hello I am trying to create a user input shell scipt. The objective is user should enter the circuit number and the input is saved in a log file. If the user does not enter anything then the question should prompt it until the circuit no. is entered. Can any one please correct the code below.... (3 Replies)
Discussion started by: sureshcisco
3 Replies

5. Shell Programming and Scripting

Assign user input to already declared array

What I am doing is creating a top menu, which a user will select a choice with a number entry. That number corresponds to a string in an array. I then want to assign that response to another array I've already declared. For example: #!/bin/bash colors=(red blue yellow) red=(cherry fire)... (2 Replies)
Discussion started by: Akilleez
2 Replies

6. Shell Programming and Scripting

every time user input create array perl

Hi, How to create array every time user input and store user input and display all array print " Enter input " my @input = split(' ', $input) chmop($input = <STDIN>; foreach ($input) { @array= @input; } print @array"\n"; (1 Reply)
Discussion started by: guidely
1 Replies

7. Shell Programming and Scripting

create an array which can store the strings from the user input in shell script

I want to create an array which can store the strings from the user input in shell script . example :- I want to store the 5 fruits name in a single array which the user provides . (1 Reply)
Discussion started by: Pkast
1 Replies

8. Shell Programming and Scripting

User input for shell

I still cannot figure out how to get this read command to work. I want the script to ask questions when prompted, and the user to enter a response. Based on response it will continue or exit. I have not worked with this type of script before so I am almost clueless on what to do, and so far google... (6 Replies)
Discussion started by: bigbenn
6 Replies

9. Shell Programming and Scripting

Shell read command is not waiting for user input

Hi, i am working on one automation , for that i have writing one shell program that take user input in "while read line" block. but read command is taking value that is readed by While block. while read line; do command 1; command 2 echo -n "Do you want to continute > " read rsp... (2 Replies)
Discussion started by: ranvijaidba
2 Replies

10. Shell Programming and Scripting

How to embed data instead of reading user input from an array?

Hello, I am running under ubuntu1 14.04 and I have a script which is sending given process names to vanish so that I'd see less output when I run most popular tools like top etc in terminal window. In usual method it works. Whenever I restart the system, I have to enter the same data from... (2 Replies)
Discussion started by: baris35
2 Replies
tie(n)								Tcl Data Structures							    tie(n)

__________________________________________________________________________________________________________________________________________________

NAME
tie - Array persistence, standard data sources SYNOPSIS
package require Tcl 8.4 package require tie::std::log ?1.1? package require tie::std::array ?1.1? package require tie::std::rarray ?1.1? package require tie::std::file ?1.1? package require tie::std::growfile ?1.1? package require tie::std::dsource ?1.1? _________________________________________________________________ DESCRIPTION
The packages listed as requirements for this document are internal packages providing the standard data sources of package tie, as described in section STANDARD DATA SOURCE TYPES of tie's documentation. They are automatically loaded and registered by tie when it itself is requested, and as such there is no need to request them on their own, although it is possible to do so. BUGS, IDEAS, FEEDBACK This document, and the packages it describes, will undoubtedly contain bugs and other problems. Please report such in the category tie of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
array, database, file, metakit, persistence, tie, untie CATEGORY
Programming tools COPYRIGHT
Copyright (c) 2008 Andreas Kupries <andreas_kupries@users.sourceforge.net> tie 1.1 tie(n)
All times are GMT -4. The time now is 06:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy