01-30-2009
Storing Command Line Values
Hi,
I am trying to read the value passed by the user and store it in a variable so that later I can read it from the variable. But I am getting errors. Can you please help? Thanks.
Code:
$ECHO "Enter the Country for which you want the installation to be executed? (US/India):"
read COUNTRY
if [ "$COUNTRY" = "us" -o "$COUNTRY" = "US" ]
then
$COUNTRY="US"
else
$COUNTRY="India"
fi
$echo "The installation is for: $COUNTRY"
Execution Result:
./Country_Test.sh: line 4: Enter the Country for which you want the installation to be executed?: command not found
us
./Country_Test.sh: line 8: us=US: command not found
./Country_Test.sh: line 13: The installation is for: us: command not found
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
Here is the description of the problem.
I am scripting for database access using k-shell on solaris box
dbaccess <databasename> - << EOF 2>/dev/null | awk 'BEGIN {FS=" "}\
{printf "%s", $1}' | grep -v "^$" | \
read cnt1
OUTPUT TO PIPE cat WITHOUT HEADINGS
select count(*) from... (1 Reply)
Discussion started by: matrixmadhan
1 Replies
2. Programming
The following program takes two command line arguments.
I want the second argument (fileCount) to be stored/printed as a int value. I tried my best to typecast the char to int (check the printf statement at last) but is not working...the output is some junk value.
This program is in its... (3 Replies)
Discussion started by: frozensmilz
3 Replies
3. UNIX for Dummies Questions & Answers
Hi,
My code is as below:
integer i=7
while ((i <= 5 ));
do
# test_out is a variable which contains data separated by "^".
a= `echo $test_out | cut -d"^" -f$i`
echo "$a"
(( i = i + 1));
done
From the above code, i kept $i after f so that i can capture all the data which is... (1 Reply)
Discussion started by: sandeep_1105
1 Replies
4. Shell Programming and Scripting
i have a file called file.txt having the following entries.
2321
2311
2313
4213
i wnat to store these values in a list and i want to iterate the list using loop and store it in another list (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies
5. Shell Programming and Scripting
hi all
I am using awk utility to parse the file and fetching two different vaues from two different record of a record set.
I am able to see the result, now i want to store the result and perform some check of each values form database to mark valid and invalid.
could you please help me... (3 Replies)
Discussion started by: singhald
3 Replies
6. Shell Programming and Scripting
Friends,
I have to execute a command and store its contents into an array using shell. this is what i have tried
#!/bin/bash
disk_names = ($(`iostat -xtc | egrep -v "device|nfs" | awk '{print $1}'| tr '\n' ' ' `))
But its throwing an error message as
./test-script
./test-script:... (6 Replies)
Discussion started by: achak01
6 Replies
7. Shell Programming and Scripting
I am reading a number of files but then I want to put the ranges
xmin xmax ymin ymax
as arrays for each file.
Any idea how I can do this???
set j = 1
echo "Welcome $i times"
while ( $j <= $i )
echo "$j"
set fname = $fin-bst-misf.xy
echo " "$fname
... (0 Replies)
Discussion started by: kristinu
0 Replies
8. Shell Programming and Scripting
I have the following csh script which lets the use pass the following as an argument
-legend=tag1/tag2/tag3/tag4/tag5/tag6/tag7
We pass a number of tags separated by '/'. I want to save the legend tags in an array and have done as below. How can I improve on this as things are getting quite... (3 Replies)
Discussion started by: kristinu
3 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I am writing a shell script where,
x=y
y=z
When I want to print z, I can do
$y
How do I use only "x" without any direct reference to "y" to print z?
Thanks,
-G (3 Replies)
Discussion started by: gaurab
3 Replies
10. Shell Programming and Scripting
Am using a find command in my script .The output may be one or more. I need to store those values in a array and need to access those. Am unable to find the solution . Any help on this will be helpful.
if
< code>
else a=<find command output which gives the file name either 1 or more>
if 1... (1 Reply)
Discussion started by: rogerben
1 Replies
LEARN ABOUT DEBIAN
uri::heuristic
URI::Heuristic(3pm) User Contributed Perl Documentation URI::Heuristic(3pm)
NAME
URI::Heuristic - Expand URI using heuristics
SYNOPSIS
use URI::Heuristic qw(uf_uristr);
$u = uf_uristr("perl"); # http://www.perl.com
$u = uf_uristr("www.sol.no/sol"); # http://www.sol.no/sol
$u = uf_uristr("aas"); # http://www.aas.no
$u = uf_uristr("ftp.funet.fi"); # ftp://ftp.funet.fi
$u = uf_uristr("/etc/passwd"); # file:/etc/passwd
DESCRIPTION
This module provides functions that expand strings into real absolute URIs using some built-in heuristics. Strings that already represent
absolute URIs (i.e. that start with a "scheme:" part) are never modified and are returned unchanged. The main use of these functions is to
allow abbreviated URIs similar to what many web browsers allow for URIs typed in by the user.
The following functions are provided:
uf_uristr($str)
Tries to make the argument string into a proper absolute URI string. The "uf_" prefix stands for "User Friendly". Under MacOS, it
assumes that any string with a common URL scheme (http, ftp, etc.) is a URL rather than a local path. So don't name your volumes after
common URL schemes and expect uf_uristr() to construct valid file: URL's on those volumes for you, because it won't.
uf_uri($str)
Works the same way as uf_uristr() but returns a "URI" object.
ENVIRONMENT
If the hostname portion of a URI does not contain any dots, then certain qualified guesses are made. These guesses are governed by the
following environment variables:
COUNTRY The two-letter country code (ISO 3166) for your location. If the domain name of your host ends with two letters, then it is
taken to be the default country. See also Locale::Country.
HTTP_ACCEPT_LANGUAGE, LC_ALL, LANG
If COUNTRY is not set, these standard environment variables are examined and country (not language) information possibly found in
them is used as the default country.
URL_GUESS_PATTERN
Contains a space-separated list of URL patterns to try. The string "ACME" is for some reason used as a placeholder for the host
name in the URL provided. Example:
URL_GUESS_PATTERN="www.ACME.no www.ACME.se www.ACME.com"
export URL_GUESS_PATTERN
Specifying URL_GUESS_PATTERN disables any guessing rules based on country. An empty URL_GUESS_PATTERN disables any guessing that
involves host name lookups.
COPYRIGHT
Copyright 1997-1998, Gisle Aas
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-02-11 URI::Heuristic(3pm)