Sponsored Content
Full Discussion: Read variable inputs
Top Forums Shell Programming and Scripting Read variable inputs Post 302788661 by newkid.7955 on Tuesday 2nd of April 2013 09:43:36 AM
Old 04-02-2013
MySQL Read variable inputs

I am trying to make an interactive script. Only problem my inputs are not read and correctly channeled.

Please help:



Here is my code

Code:
#!/bin/sh
PATHSCRIPT=/home/pp/tmp

#if [ -z "$1" ]; then
# echo "Syntax : $0 input off lat sample"
#  exit 1
#  fi
echo "Choice of Graph"

echo "1 -- Type one graph 2 -- Type two graph 3 -- type three graph"


 read num

if [[$num -eq 2]]; then

#echo " Enter arguments seperated with space: input off lat sample"
echo "Syntax : $0 input off lat sample"
#read $input $off $lat $sample
if [ $# -lt 2 ];
then
echo -e $HELP
exit 1
else
INPUT=$1
shift
OFF=$1
shift
LAT=$1
shift
SAMPLE=$1
shift
fi

else

if [[num==1]]; then
echo " Enter arguments seperated with space: input off lat sample"
#read $input $off $lat $sample

else

echo " Enter arguments seperated with space: input off lat sample"
#read $input $off $lat $sample
fi

fi

I keep receiving this error:

Choice of Graph
"1 -- Type one graph 2 -- Type two graph 3 -- type three graph"
+ read num
2
+ [[2 -eq 2]]
./mastergraph_options.sh: 1: [[2: not found
+ [[num==1]]
./mastergraph_options.sh: 1: [[num==1]]: not found
+ echo Enter input off lat sample
Enter arguments seperated with space: input off lat sample


I cannot get past this place.
Please help me read the
--Choice 1,2 or 3
-- channel it to the right format of files to be entered
Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Cannot read in variable using read on first try

Hi, My problem is : echo Division read vDivision variable1=`cut -c **something****' echo Do you want to proceed ? read ans I cant seem to read in ans on the first try and have to repeatedly enter the return key. If i remove the ` ` statement its ok but i need that line for... (1 Reply)
Discussion started by: normie
1 Replies

2. UNIX for Dummies Questions & Answers

Cant read in variable on first try

Hi, My problem is : echo Division read vDivision variable1=`cut -c **something****' echo Do you want to proceed ? read ans I cant seem to read in ans on the first try and have to repeatedly enter the return key. If i remove the ` ` statement its ok but i need that line for... (1 Reply)
Discussion started by: normie
1 Replies

3. Shell Programming and Scripting

read n number of inputs

Hello, I think its a sinple query but somehow i m stucked up here... I am trying to enter n number of inputs from the user and write them in an input file ie row wise... I tried standard commands like $echo "enter the inputs for the file" $read var1 var2 var3 var4 test1 test2... (14 Replies)
Discussion started by: er_aparna
14 Replies

4. Programming

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 Reply)
Discussion started by: yhacks
1 Replies

5. Shell Programming and Scripting

read several inputs and if none input set to 9999

need a script that goes something like this #!/usr/bin/bash echo "input up to TEN values, separated by spaces" read vari1 vari2 vari3 vari4 vari5 vari6 vari7 vari8 vari9 vari10 #set null variables to 9999 (somehow?) #now echo all variables echo $vari1 $vari2 $vari3 $vari4 $vari5 $vari6... (1 Reply)
Discussion started by: ajp7701
1 Replies

6. Shell Programming and Scripting

How to read inputs from a file

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

7. Programming

Using ioctl to read mice inputs

I was wondering if its possible to read mouse inputs using ioctl functions somehow ? If it is not too much of trouble can anyone write or even direct me to sample code of ioctl reading someother HID. (2 Replies)
Discussion started by: maverick_
2 Replies

8. Shell Programming and Scripting

Can I use read to read content of a variable

Can I use the read command to read the contents of a variable? I'm trying by using the following code and getting nothing back. I'm in a Linux environment. #!/bin/ksh IFS=~ VAR1=1~2~3~4 echo $VAR1 | read a b c d print "$a $b $c $d" (9 Replies)
Discussion started by: nmalencia
9 Replies

9. Shell Programming and Scripting

how to read a variable?

i want to ask how can i read a variable? like for i in 1 2 3 do cat file${1} | while read something do if echo " file name: file${i}" >>temp else echo ", file${i}" >>temp done done it is not working, can i do something like that? actually i want the output below file name:... (4 Replies)
Discussion started by: mingming88
4 Replies

10. Shell Programming and Scripting

Output read variable

Hi all, how read varaible and ouput in colum, e.g. $ echo $VAR1 opc op odi games gopher vcsa abrt I like $ echo $VAR1 opc op odi games gopher vcsa abrt (3 Replies)
Discussion started by: aav1307
3 Replies
Geo::GoogleEarth::Pluggable::Contrib::Point(3pm)	User Contributed Perl Documentation	  Geo::GoogleEarth::Pluggable::Contrib::Point(3pm)

NAME
Geo::GoogleEarth::Pluggable::Contrib::Point - Geo::GoogleEarth::Pluggable Point Object SYNOPSIS
use Geo::GoogleEarth::Pluggable; my $document=Geo::GoogleEarth::Pluggable->new(); $document->Point(); DESCRIPTION
Geo::GoogleEarth::Pluggable::Contrib::Point is a Geo::GoogleEarth::Pluggable::Placemark with a few other methods. USAGE
my $placemark=$document->Point(name=>"Point Name", lat=>$lat, lon=>$lon, alt=>$alt); CONSTRUCTOR
new my $placemark=$document->Point( name => "White House", lat => 38.89769, #signed decimal degrees WGS-84 lon => -77.036549, #signed decimal degrees WGS-84 alt => 30, #meters above ellipsoid WGS-84 ); METHODS
subnode lat Sets or returns latitude. The format is signed decimal degrees WGS-84. my $lat=$placemark->lat; lon Sets or returns longitude. The format is signed decimal degrees WGS-84. my $lon=$placemark->lon; alt Sets or returns altitude. The units are meters above the ellipsoid WGS-84. my $alt=$placemark->alt; Typically, Google Earth "snaps" Placemarks to the surface regardless of how the altitude is set. BUGS
Please log on RT and send to the geo-perl email list. SUPPORT
DavisNetworks.com supports all Perl applications including this package. AUTHOR
Michael R. Davis (mrdvt92) CPAN ID: MRDVT COPYRIGHT
This program is free software licensed under the... The BSD License The full text of the license can be found in the LICENSE file included with this module. SEE ALSO
Geo::GoogleEarth::Pluggable, XML::LibXML::LazyBuilder, Geo::GoogleEarth::Pluggable::Placemark perl v5.14.2 2010-12-27 Geo::GoogleEarth::Pluggable::Contrib::Point(3pm)
All times are GMT -4. The time now is 03:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy