05-23-2008
Handling variable inputs
Hi,
Is there any way to handle variable inputs.
If an application handles more than one input
how to print the input values.
Example :
./a.out 1 "hi" 3
./a.out 1
./a.out 1 3 4 "hello"
output should be:
1
hi
3
1
1
3
4
"hello"
Thanks in advance
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Have tried the search, but nothing resembles what I'd like to accomplish. I am attempting to write a script that will allow the user to input a list of data at the command prompt, then the data is used by another script for processing. I am allowing the user a list of 10 members in order to... (4 Replies)
Discussion started by: douknownam
4 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
:confused:
can anyone throw some light on variable handling in UNIX script??
I want to know about the local variables we declare inside the UNIX script.
e.g.
i=10
OR
cat file1 | while read line
do
echo $line
done
etc.
Does UNIX have any data types
Can some one... (1 Reply)
Discussion started by: VENC22
1 Replies
3. Shell Programming and Scripting
Hi,
I have a shell script that has to taken inputs from a file say "Inputs". Now I take 2 inputs at a time. Suppose the Inputs file contains numbers like
2
3
4
5
Now I have a written a script for adding 2 numbers. When I run the script for first time 2 and 3 must be the inputs. When i run the... (4 Replies)
Discussion started by: sendhil
4 Replies
4. Shell Programming and Scripting
I am trying to extract two fields from the output of ifconfig command on one of my sun server . The output looks like :
root@e08k18:/tmp/test# ifconfig -a
lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
ce0:... (9 Replies)
Discussion started by: kpatel786
9 Replies
5. Shell Programming and Scripting
Hello;
Please I need to read inputs from a file change 1 or 2 things the output to another file. (1 Reply)
Discussion started by: jimoney
1 Replies
6. Shell Programming and Scripting
I am trying to make an interactive script. Only problem my inputs are not read and correctly channeled.
Please help:
Here is my code
#!/bin/sh
PATHSCRIPT=/home/pp/tmp
#if ; then
# echo "Syntax : $0 input off lat sample"
# exit 1
# fi
echo "Choice of Graph"
echo "1 -- Type... (5 Replies)
Discussion started by: newkid.7955
5 Replies
7. Shell Programming and Scripting
need a help to get a script:
bash # ./xx.sh
>> count
567
script will run the xx.sh and it will go to >> then run "count"
will get the result "567" and print it (7 Replies)
Discussion started by: Aditya.Gurgaon
7 Replies
8. Shell Programming and Scripting
Hi, i want to print 2nd column value with the below script. I need to take input of the string i need to search in that file and file name. How can i take these two as inputs? using read command? Getting error for below script.
echo "enter SID"
read SID
echo "enter filename"
read filename... (8 Replies)
Discussion started by: sam_bd
8 Replies
9. Shell Programming and Scripting
Hi guys,
im newbie, im trying something, but cannot figure out how to bring together case with 2 inputs.
Something like "enter your name" and "enter your age".
I had idea but dont now how to finish it as I said i'm just a beginner.
#!/bin/bash
echo "Name"
echo -n "Enter your name: "... (2 Replies)
Discussion started by: PrincMehi
2 Replies
10. Shell Programming and Scripting
I have doubts with the following command:
% find "$1" -name "*.html" -print0 | sort -zn | xargs -r -0 -n 1 sh -c 'echo "Dumping file: $2" >> "$1"; w3m "$2" >> "$1" 2>&1 ' sh "$2"
I have doubts in the input arguments value i.e. $0, $1, $2...
Step by step:
1.- % find "$1" -name "*.html"... (10 Replies)
Discussion started by: puertas12
10 Replies