Hi Guys,
I have a scripts that uses a while loop to read a file and set 2 variables.
How can I do this so the variables can be used outside the while loop ?
Below is an example....# ./junk2 -m -e user
EXE=user master=TRUE
DB_TAG=PRODUCT
In loop MST=MST=testsvr1:3110
In loop ARGS=... (2 Replies)
I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends.
As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Hi, say I have a simple sh script like this:
for i in a b c d
do
for j in 1 2 3 4
do
echo "$i $j"
done
done
and the output is
a 1
a 2
a 3
a 4
b 1 (20 Replies)
Can we assign two variables in a for loop?
I have an input file:
000301|20100502
835101|20100502
I want to read this file in a for loop and assign values to two different variables.
I did this now but did not work
for STORE,RUNDATE in `awk -F\| '{print $1,$2}' inputfile
... (4 Replies)
Hi,
I need help on for loop need to add domain and IP
In domain list
1.com
2.com
3.com
In Ip list
1.1.0.1
1.2.0.1
1.3.0.1
1.com 1.1.0.1
2.com 1.2.0.1
3.com 1.3.0.1
I need to excute this command (4 Replies)
Greetings. I'm completely new to shell scripting and quickly trying to catch on. Here's my scenario:
I have a text file, named ip.txt, containing IP addresses. I want to automatically perform a whois query on each address in the file, search the output for the country, and then put both the IP... (4 Replies)
i am having a file contants as below
my requirement is
for file in `awk -F "," '{print $8,$9}'` <temp.txt
echo "$file"
echo "$file">test.txt
a=`awk -F "," '{print $1}' `<test.txt
b=`awk -F "," '{print $2}' `<test.txt
but script reads , i want both the vales for further... (5 Replies)
Hi,
I have a out from a command i need to grep a report. For that i need loop 3 variable for that. How i can loop need help.
Symmetrix ID : 123456
Masking View Name : Host16
Last updated at : 04:13:06 PM on Thu Mar 17,2011
Initiator Group Name : Host16
Host... (3 Replies)
I am pretty new to Unix. Trying to pick up some slack while a coworker is out on vacation.
Basically the script is working fine however when I go through the testing phase and have to make mods it is a pita.
Here is an example of what I have
#!/bin/ksh
if
then
echo... (8 Replies)
Hello, please assist:
users="test1 test2"
keytest1="abcd"
keytest2="dbcd"
for i in $users
do
echo "$key${i}" > fileout
done
So, my objective is to take the current user (ie test1) in loop and echo its associated keyname (ie keytest1) variable to a file.
The echo... (2 Replies)
Discussion started by: motdman
2 Replies
LEARN ABOUT DEBIAN
html::template::compiled::reference
HTML::Template::Compiled::Reference(3pm) User Contributed Perl Documentation HTML::Template::Compiled::Reference(3pm)NAME
HTML::Template::Compiled::Reference - A quick reference for HTML::Template::Compiled syntax
TAGSTYLES
<TMPL_IF var><TMPL_VAR foo></tmpl_if var>
<!-- TMPL_IF var --><!-- TMPL_VAR foo --><!-- /tmpl_if var -->
<%if var %><%= foo %><%/if var %>
Optional tagstyle 'tt':
[%if var %][%= foo %][%/if var %]
ACCESSING VARIABLES
<%= _.foo %>
outputs foo in the cuurent position of the stash and is the same as
<%= foo %>
<%= .config.url %>
goes to root of parameter stash; like $params->{config}->{url}
<%= ..foo %>
goes one level up in stash
<%= list[3].keyname.method %>
acts like: $stash->[3]->{keyname}->method
TAGS
VAR
<%var foo%> or <%= foo%>
IF, IF_DEFINED, UNLESS, ELSIF, ELSE
conditions like in Perl
LOOP, WHILE, EACH
for-loop and while-loop like in Perl.
<%loop cds%><%= __counter__%>. Title: <%= _.title%><%/loop cds%>
<%loop cds join=", " %><%= _.title%><%/loop cds%>
<%while resultset.next%><%= __counter__%>. <%= _.foo %><%/while %>
<%each hashref%><%= __key__ %>=<%= __value__ %><%/each %> (sorted alphanumeric)
<%each hashref sort=alpha %><%= __key__ %>=<%= __value__ %><%/each %> (sorted alphanumeric)
<%each hashref sort=num %><%= __key__ %>=<%= __value__ %><%/each %> (sorted numeric)
<%each hashref sort=0 %><%= __key__ %>=<%= __value__ %><%/each %> (not sorted)
WITH
<%with cds[0].artist.fanclub%><%= _.address%><%= _.homepage%><%/with %>
INCLUDE, INCLUDE_VAR
<%include template.htc%>
<%include_var param_with_template_name%>
COMMENT, VERBATIM, NOPARSE
<%comment explanation %>
This will not appear in the rendered template.
blah blah...
<%/comment explanation %>
SWITCH, CASE
<%switch .config.language%>
<%case de%>Hallo
<%case es%>Hola
<%case en,default%>Hello
<%/switch .config.language%>
PERL
See section Perl in HTML::Template::Compiled
ATTRIBUTES
Each attribute can be written as
attribute=foo
attribute="some thing"
attribute='some "thing"'
NAME
You can omit the 'name=' here.
<%if var%>var<%elsif name=var2%>var4<%/if%>
Can be used in all tags.
ESCAPE
<%= message escape=html %>
<%= params escape=url %>
<%= params escape=js %>
<%= some_var escape=dump|html%>
Can be used in "VAR"-tags.
DEFAULT
<%= this.var.might_be_undef default="my fault" %>
Can be used in "VAR"-tags.
ALIAS
<%loop cds alias="cd" %><%= cd.title %><%/loop cds %>
Can be used in "LOOP" and "WHILE". Works like "SET_VAR" and is short for
<%loop cds %><%set_var cd value=_ %><%= cd.title %><%/loop cds %>
Useful for nested loops.
SET_VAR
<%set_var myvar value=.another.var %>
<%set_var myvar2 expr="60 * 60 * 24" %>
This creates a variable similar to local() in perl. To use such a var or an alias in includes, you must use "USE_VARS" in the include.
USE_VARS
<!-- recognize myvar and myvar2 as variables not parameter stash -->
<%use_vars myvar,myvar2 %>
myvar: <%= myvar %>
JOIN
<%loop cds join=", " %><%= _.title%><%/loop cds%>
can be used in "LOOP"
BREAK
<%loop cds break="3" %>
<%= _.title%><%if __break__ %>
</%if %>
<%/loop cds%>
Sets "__break__" to 1 every xth loop. Can be used in "LOOP", "WHILE" and "EACH"
OPTIONS
(loop)_context_vars
<%= __index__ %> the current loop index starting at 0
<%= __counter__ %> the current loop index starting at 1
<%= __first__ %> true if first iteration
<%= __last__ %> true if last iteration
<%= __odd__ %> true if __counter__ is odd
<%= __inner__ %> true if not last or first iteration
<%= __key__ %> the key of an EACH iteration
<%= __value__ %> the value of an EACH iteration
<%= __break__ %> see L<"BREAK"> above
<%= __filename__ %> filename of current template (since 0.91_001)
<%= __filenameshort__ %> short filename of current template (since 0.91_001)
perl v5.14.2 2012-05-26 HTML::Template::Compiled::Reference(3pm)