sh shell user input and stote it to a array


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sh shell user input and stote it to a array
# 8  
Old 11-16-2007
Array are available in sh

Quote:
Originally Posted by user_prady
Thanks for your reply...
can I have a ksh code for the above problem ?
The equivalent sh code is

declare -a my_array
//take user input
// store in variable/filre
//if variable then
my_array=( "variable")
//if file then
my_array=(`cat file`)

//itarate array for values
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question
platform::shell(n)					       Tcl Bundled Packages						platform::shell(n)

__________________________________________________________________________________________________________________________________________________

NAME
platform::shell - System identification support code and utilities SYNOPSIS
package require platform::shell ?1.1.4? platform::shell::generic shell platform::shell::identify shell platform::shell::platform shell _________________________________________________________________ DESCRIPTION
The platform::shell package provides several utility commands useful for the identification of the architecture of a specific Tcl shell. This package allows the identification of the architecture of a specific Tcl shell different from the shell running the package. The only requirement is that the other shell (identified by its path), is actually executable on the current machine. While for most platform this means that the architecture of the interrogated shell is identical to the architecture of the running shell this is not generally true. A counter example are all platforms which have 32 and 64 bit variants and where a 64bit system is able to run 32bit code. For these running and interrogated shell may have different 32/64 bit settings and thus different identifiers. For applications like a code repository it is important to identify the architecture of the shell which will actually run the installed packages, versus the architecture of the shell running the repository software. COMMANDS
platform::shell::identify shell This command does the same identification as platform::identify, for the specified Tcl shell, in contrast to the running shell. platform::shell::generic shell This command does the same identification as platform::generic, for the specified Tcl shell, in contrast to the running shell. platform::shell::platform shell This command returns the contents of tcl_platform(platform) for the specified Tcl shell. KEYWORDS
operating system, cpu architecture, platform, architecture platform::shell 1.1.4 platform::shell(n)