Hi Guys,
I want to use if conition for my script. Before I used it tried it with some small test scripts. But it was not succeeded. My script and screen output as follows,
Script:
echo 'Do you think Yes or No (y/n) : '
read ans
echo You input anser as $ans
ans1=y
if ( $ans == $ans1... (5 Replies)
hi, :)
pls consider the following if statement
if //g') ]
then
........
else
.......
when i execute the script i am getting the following error
'(' unexpected
I am not able to find the mistake.
could anybody tell where i did mistake.
cheers
RRK (13 Replies)
hi,
actully i need the belp for the below.
host_list=" Host1 host2 host3 host4 "
n=`hostname`
i need to put the condition like the below
if n is among the host mention in the host_list if
then
#some stugg
else
# some other stuff
fi (1 Reply)
Hi ,
I am trying the following simple script . But it is always giving 1 output. Dont know why
#!/bin/sh
find . -name "a.log"
if ; then
echo "1"
else
echo "0"
fi
Kindly advice. it is giving 1 output even when the a.log file is not there (26 Replies)
a=rhino
b=crocodil
c=testsc
if && "$c" = testsc ]
then
echo "Test #5 succeeds."
else
echo "Test #5 fails."
fi
i need to test or condition before check the output with AND condition. ur help is much appreciated... (11 Replies)
Hi,
I need to use if condition for search a file pattern on a particular location.
cd $file_Path
if ||
then
do this
else
do that
fi
Can someone help me with the if part, how i can put those conditions?
make sure format should be *.file* and *.file
file is a keyword which i... (5 Replies)
Hi i am writing a script where i am running , 5 scripts together in 1 script .
Now what i want is when these 5 scripts run completely , i should execute some other commands like i have compile the data etc.
I have have 5 echo statements at the end of all those scripts .
Like echo "1 is done" in... (1 Reply)
Hi All,
I am using below if condition to check whether null is passed as a parameter to the program
if or ;
then
echo "ABC">>$FILE
else
echo "CDF">>$FILE
fi
However it is saying me null=null command not found . Please help me with this (9 Replies)
Hi All,
Seeking for your assistance on how to condition it correctly.
cat file1.txt
290,1663,43,888,0,0.00,86.91,0.00,26.98,0.00
290,1663,52,0,0,0.00,0.00,0.00,0.00,0.00
290,1663,52,888,0,0.00,34.60,0.00,9.00,0.00
1st scenario:
if the fourth column contains 888s and 0s it is by... (16 Replies)
Discussion started by: znesotomayor
16 Replies
LEARN ABOUT DEBIAN
config::model::dumpasdata
Config::Model::DumpAsData(3pm) User Contributed Perl Documentation Config::Model::DumpAsData(3pm)NAME
Config::Model::DumpAsData - Dump configuration content as a perl data structure
VERSION
version 2.021
SYNOPSIS
use Config::Model ;
use Log::Log4perl qw(:easy) ;
use Data::Dumper ;
Log::Log4perl->easy_init($WARN);
# define configuration tree object
my $model = Config::Model->new ;
$model ->create_config_class (
name => "MyClass",
element => [
[qw/foo bar/] => {
type => 'leaf',
value_type => 'string'
},
baz => {
type => 'hash',
index_type => 'string' ,
cargo => {
type => 'leaf',
value_type => 'string',
},
},
],
) ;
my $inst = $model->instance(root_class_name => 'MyClass' );
my $root = $inst->config_root ;
# put some data in config tree the hard way
$root->fetch_element('foo')->store('yada') ;
$root->fetch_element('bar')->store('bla bla') ;
$root->fetch_element('baz')->fetch_with_id('en')->store('hello') ;
# put more data the easy way
my $step = 'baz:fr=bonjour baz:hr="dobar dan"';
$root->load( step => $step ) ;
print Dumper($root->dump_as_data);
# $VAR1 = {
# 'bar' => 'bla bla',
# 'baz' => {
# 'en' => 'hello',
# 'fr' => 'bonjour',
# 'hr' => 'dobar dan'
# },
# 'foo' => 'yada'
# };
DESCRIPTION
This module is used directly by Config::Model::Node to dump the content of a configuration tree in perl data structure.
The perl data structure is a hash of hash. Only CheckList content will be stored in an array ref.
Note that undefined values are skipped for list element. I.e. if a list element contains "('a',undef,'b')", the data structure will contain
'a','b'.
CONSTRUCTOR
new ( )
No parameter. The constructor should be used only by Config::Model::Node.
Methods
dump_as_data(...)
Return a perl data structure
Parameters are:
node
Reference to a Config::Model::Node object. Mandatory
full_dump
Also dump default values in the data structure. Useful if the dumped configuration data will be used by the application. (default is
yes)
skip_auto_write
Skip node that have a "perl write" capability in their model. See Config::Model::AutoRead.
auto_vivify
Scan and create data for nodes elements even if no actual data was stored in them. This may be useful to trap missing mandatory values.
ordered_hash_as_list
By default, ordered hash (i.e. the order of the keys are important) are dumped as Perl list. This is the faster way to dump such hashed
while keeping the key order. But it's the less readable way.
When this parameter is 1 (default), the ordered hash is dumped as a list:
[ A => 'foo', B => 'bar', C => 'baz' ]
When this parameter is set as 0, the ordered hash is dumped with a special key that specifies the order of keys. E.g.:
{ __order => [ 'A', 'B', 'C' ] ,
B => 'bar', A => 'foo', C => 'baz'
}
Methods
dump_annotations_as_pod(...)
Return a string formatted in pod (See perlpod) with the annotations.
Parameters are:
node
Reference to a Config::Model::Node object. Mandatory
experience
master, advanced or beginner
check_list
Yes, no or skip
AUTHOR
Dominique Dumont, (ddumont at cpan dot org)
SEE ALSO
Config::Model,Config::Model::Node,Config::Model::ObjTreeScanner
perl v5.14.2 2012-11-09 Config::Model::DumpAsData(3pm)