02-24-2005
echo variable problem
hi
I have say five variable.
I would ask the user which one they want me to print and then print accordingly.
TEST_1='10.2.3.4'
TEST_2='11.2.3.5'
TEST_3='12.2.3.5'
TEST_4='13.2.3.5'
TEST_5='14.2.3.5'
print_var()
{
echo "Accessing var num $1"
echo TEST$1
#??? But How do I print the value of say TEST_1 here base on user input
}
echo -n "Please enter the var num: "
read num
print_var $num
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a variable that is outputting a lot of space.
here has been 45 lines returned ...
how can I remove the spaces between the "been and the 45"
CODE:
fil_len=`wc -l < coshb.txt`
if ; then
cat coshb.txt | more
echo " "
echo "There has been ${fil_len} lines... (4 Replies)
Discussion started by: jagannatha
4 Replies
2. Shell Programming and Scripting
I am modifying an existing script and it has the following line:
export SomeEnvVar=`echo ${SomeLocalVar}`
Why wouldn't it just read:
export SomeEnvVar=${SomeLocalVar}
Is there some reason to use echo instead of a direct assignment? :confused: (2 Replies)
Discussion started by: shellburger
2 Replies
3. Shell Programming and Scripting
Hi everyone,
I am trying to create a simple batch file to make SQL backups. this part of it works fine. Currently the script can mysql dump the databases, compress them, delete the .sql, compress the individual tar.gz into one larger one, delete the smaller files, encrypt the final tar.gz and... (1 Reply)
Discussion started by: luma
1 Replies
4. Shell Programming and Scripting
$total=500
echo "scale=2; $val1*100/$total" | bc
echo "scale=2; $val2*100*100/$total" | bc
echo "scale=2; $val3*100/$total" | bc
I want to make the above code to be accomplish in a single echo line.
For instance output:21.3, 44.2, 51.6
How to achieve that, some one please help, i just... (5 Replies)
Discussion started by: alvin0618
5 Replies
5. Shell Programming and Scripting
Hi,
i want to create an user-friendly script where you are asked for two numbers. i would like that these two number to be separated with "--" for example, but i can't figure out how to do this.
for example
read -p "Insert lowest and highest value: " min ; echo -n "-- "; read max
so... (3 Replies)
Discussion started by: ezitoc
3 Replies
6. UNIX for Dummies Questions & Answers
I've testing the following code:
echo test.txt | cut -d . -f1and get the output "text"
So why can't i assign the command to a variable?
VAR='"echo test.txt | cut -d . -f1"'
echo $VAR (5 Replies)
Discussion started by: jl487
5 Replies
7. Shell Programming and Scripting
Hi,
I'm new here so I want to say hello to everyone first!
I searched google and this forum for a similar problem, but wasn't successful
#! /bin/bash
I'm trying to output (echo) n lines of a text file to the screen (later into another file).
But I have problem with the sed command, it won't... (1 Reply)
Discussion started by: studiologe
1 Replies
8. Shell Programming and Scripting
#!/bin/bash
varA="AAA1"
varB="BBB2"
varC="CCC3"
for proccx in $varA $varB $varC
do
echo "the current name is ????? , the value is $proccx"
echo " "
done
#end of script
I want the output to look something like this:
the current name is varA, the value is AAA1
the current name is... (5 Replies)
Discussion started by: ajp7701
5 Replies
9. Shell Programming and Scripting
if
then
echo "Entry Valid : ${x_oug}"
else
echo "Entry Invalid : " 0
fi
In the above code the 3rd line is not working... it does not print anything
I tried following as well .. but no luck!
echo "Entry Valid : ... (13 Replies)
Discussion started by: Chetanz
13 Replies
10. Shell Programming and Scripting
Stumped with the formatting of the awk output when used with variables, e.g.:
awk -F, 'BEGIN {OFS=","} print {$2,$3,$4}' $infile1
produces the desired output (with rows), but when echoing the variable below, the output is one continuous line
var1=$(awk -F, 'BEGIN {OFS=","} print... (4 Replies)
Discussion started by: ux4me
4 Replies
LEARN ABOUT XFREE86
posttek
posttek(1) User Commands posttek(1)
NAME
posttek - PostScript translator for Tektronix 4014 files
SYNOPSIS
posttek [-c num] [-f name] [-m num] [-n num] [-o list] [-p mode] [-w num] [-x num] [-y num] [file...]
/usr/lib/lp/postscript/posttek
DESCRIPTION
The posttek filter translates Tektronix 4014 graphics files into PostScript and writes the results on the standard output. If no files are
specified, or if - is one of the input files, the standard input is read.
OPTIONS
-c num Print num copies of each page. By default, only one copy is printed.
-f name Print text using font name. Any PostScript font can be used, although the best results will be obtained only with constant width
fonts. The default font is Courier.
-m num Magnify each logical page by the factor num. Pages are scaled uniformly about the origin which, by default, is located at the cen-
ter of each page. The default magnification is 1.0.
-n num Print num logical pages on each piece of paper, where num can be any positive integer. By default, num is set to 1.
-o list Print pages whose numbers are given in the comma-separated list. The list contains single numbers N and ranges N1 - N2. A missing
N1 means the lowest numbered page, a missing N2 means the highest. The page range is an expression of logical pages rather than
physical sheets of paper. For example, if you are printing two logical pages to a sheet, and you specified a range of 4, then two
sheets of paper would print, containing four page layouts. If you specified a page range of 3-4, when requesting two logical
pages to a sheet; then only page 3 and page 4 layouts would print, and they would appear on one physical sheet of paper.
-p mode Print files in either portrait or landscape mode. Only the first character of mode is significant. The default mode is landscape.
-w num Set the line width used for graphics to num points, where a point is approximately 1/72 of an inch. By default, num is set to 0
points, which forces lines to be one pixel wide.
-x num Translate the origin num inches along the positive x axis. The default coordinate system has the origin fixed at the center of the
page, with positive x to the right and positive y up the page. Positive num moves everything right. The default offset is 0.0
inches.
-y num Translate the origin num inches along the positive y axis. Positive num moves everything up the page. The default offset is 0.0.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
non-zero An error occurred.
FILES
/usr/lib/lp/postscript/forms.ps
/usr/lib/lp/postscript/ps.requests
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWpsf |
+-----------------------------+-----------------------------+
SEE ALSO
download(1), dpost(1), postdaisy(1), postdmd(1), postio(1), postmd(1), postprint(1), postreverse(1), attributes(5)
NOTES
The default line width is too small for write-white print engines, such as the one used by the PS-2400.
SunOS 5.10 9 Sep 1996 posttek(1)