User control passing parameter

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting User control passing parameter
# 1  
Old 06-24-2002
User control passing parameter

there is a example:
sh shell

name () {
echo $1
echo $2
echo $3

echo "Enter value:"
read a b c d
name $a $b

here permit user enter 1-4 value to the variables respectively, question is : no restrict for user input...?
using only 1 variable to yield all user input?

anyone can help?
# 2  
Old 06-24-2002
Sorry but I'm having a bit of trouble understanding your problem....can you rephrase it....
# 3  
Old 06-25-2002
We are focsing on the question:

Q1. user was asked for input data or value, so that user can enter any number of data or value like: 1 4 a 45 23 ... then pass those values to the function?

Q2. the above script show in the way to limit 4 values input, can 4 values using only 1 variable in which passing the value to the function only get $1 variable instead?

can u get me?
# 4  
Old 06-25-2002
I'm not sure.....(This isn't homework is it?) I don't get what you mean with the 1-4 thing....but does this help at all ?

You can easily read in a list of characters from a promt as one variable... i.e.

Script is called my_script:

echo "enter a few strings"
read myinput
echo "This is the vairable called myinput that I have: $myinput"

Then when executed you have:

$ my_script
enter a few strings
a qwer 35 asf 45
This is the vairable called myinput that I have: a qwer 35 asf 45

Therefore multiple strings can be passsed into one variable. Basically the spaces are just characters within the string.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing parameter through file

Hi , I am passing date parameter through file my shell script is #set -x #set -v asd=$1 asd1=$2 echo $asd echo $asd1 Passing parameter as below sh `cat file1.txt` Output (2 Replies)
Discussion started by: kaushik02018
2 Replies

2. Shell Programming and Scripting

Passing parameter more than 9

Hi, I've written a script where eleven parameter to be passed from command line which is inserting into an oracle table, it is working but the tenth and 11th parameter are not accepting as given it is referring to 1st parameter. HERE IS THE SCRIPT #!/bin/ksh #set -o echo $*... (4 Replies)
Discussion started by: sankar
4 Replies

3. Shell Programming and Scripting

Passing parameter to script, and split the parameter

i am passing input parameter 'one_two' to the script , the script output should display the result as below one_1two one_2two one_3two if then echo " Usage : <$0> <DATABASE> " exit 0 else for DB in 1 2 3 do DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}` done fi (5 Replies)
Discussion started by: only4satish
5 Replies

4. Shell Programming and Scripting

Positional parameter passing

Hi All, When passing parameters to a sheel script, the parameters are referenced by their positions such as $1 for first parameter, $2 for second parameter. these positional values can only have values ranging from $0-$9 (0,1,2,3...9). I have a shell script meant to accept 20 parameters. for... (3 Replies)
Discussion started by: ogologoma
3 Replies

5. Shell Programming and Scripting

Passing parameter in quotes

Hi, PW='/as sysdba'; export PW in other module I call sqlplus ${PW} (this line I unable to change!) How I can define PW so that sqlplus calls PW in quotes i.e sqlplus '/as sysdba' I tried like this PW="'/as sysdba'"; export PW - no luck Thanks in advance (2 Replies)
Discussion started by: zam
2 Replies

6. Shell Programming and Scripting

Parameter Passing problem

Hi All, I developed a KSH script which will accept two parameters as input. These two parameters are some directories paths. In the script i am validating the number of paramaters it received as below #-------------------------------------- # Check Command line arguments... (8 Replies)
Discussion started by: Raamc
8 Replies

7. Programming

Passing parameter to makefile?

Hi, How to pass parameter to makefile? Please let me know if any one knows and also please put an example of makefile with this feature. thanks, Manju. (3 Replies)
Discussion started by: manju_p
3 Replies

8. UNIX for Advanced & Expert Users

Parameter passing in a function

I need to pass a parameter to a function in a script. My parameter is a string. When I display the parameter within my function, I only get the first word from string I pass in. How can I make the function receive the whole string (and not terminate at the first space it encounters)?. part of... (2 Replies)
Discussion started by: fastgoon
2 Replies

9. Shell Programming and Scripting

parameter passing

Hallo everyone, This is my problem below: /home/cerebrus/pax=>vat ksh: vat: not found /home/cerebrus/pax=>cat #!/bin/ksh set -x bdf|grep appsdev|awk '{ print $5 }'> class3 dd={cat class3} echo $dd /home/cerebrus/pax=> /home/cerebrus/pax=>./ + bdf +... (8 Replies)
Discussion started by: kekanap
8 Replies

10. Shell Programming and Scripting

Pass tablename as a parameter in the Control File -- sqlldr

Just wanted to know if there is a way to pass the table name as a parameter in the control file. I have two tables...Table A and Table B. LOAD DATA append INTO TABLE TABLE_B FIELDS TERMINATED BY X'09' OPTIONALLY ENCLOSED BY '"' AND '"' TRAILING NULLCOLS Rather than hard coding... (1 Reply)
Discussion started by: madhunk
1 Replies
Login or Register to Ask a Question