Sponsored Content
Full Discussion: Variable lost outside a loop
Top Forums Shell Programming and Scripting Variable lost outside a loop Post 302968307 by balajesuri on Monday 7th of March 2016 11:06:07 PM
Old 03-08-2016
Code:
ignoreTables=( visitors_15012016 visitors_Original )

ignoreString=''
for tbl in ${ignoreTables[@]}
do
    ignoreString=${ignoreString}"--ignore-table="${tbl}" "
done

mysqldump --log-error=/var/log/mysql-dump/dump.log -u USER -pPASSWD DBName $ignoreString | bzip2 > /path2file/file.sql.bz2

This User Gave Thanks to balajesuri For This Post:
 

9 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Lost Data Lost Admin

First time so excuse my ignorance please. I may not be accurately describing the issue. I have inherited a small lab mostly SUN V120s. We lost power and are trying to recover. Nope no backups... The primary issue I have is 1 box is an Oracle Server. It has 2 36Gb harddrives. I am able to... (3 Replies)
Discussion started by: murphsr
3 Replies

2. UNIX for Dummies Questions & Answers

Variable gets lost

Hi Please help! Am using unix AIX... The variable i use in the beggining of the shell script gets lost after i call the sqlldr and sql plus...no changes being done anywhere else... Thanks... (1 Reply)
Discussion started by: esh.mohan
1 Replies

3. Shell Programming and Scripting

bash and ksh: variable lost in loop in bash?

Hi, I use AIX (ksh) and Linux (bash) servers. I'm trying to do scripts to will run in both ksh and bash, and most of the time it works. But this time I don't get it in bash (I'm more familar in ksh). The goal of my script if to read a "config file" (like "ini" file), and make various report.... (2 Replies)
Discussion started by: estienne
2 Replies

4. Shell Programming and Scripting

[SHELL: /bin/sh] For loop using variable variable names

Simple enough problem I think, I just can't seem to get it right. The below doesn't work as intended, it's just a function defined in a much larger script: CheckValues() { for field in \ Group_ID \ Group_Title \ Rule_ID \ Rule_Severity \ ... (2 Replies)
Discussion started by: Vryali
2 Replies

5. Shell Programming and Scripting

printing variable with variable suffix through loop

I have a group of variables myLINEcnt1 - myLINEcnt10. I'm trying to printout the values using a for loop. I am at the head banging stage since i'm sure it has to be a basic syntax issue that i can't figure out. For myIPgrp in 1 2 3 4 5 6 7 8 9 10; do here i want to output the value of... (4 Replies)
Discussion started by: oly_r
4 Replies

6. UNIX for Dummies Questions & Answers

Loop and variable not exactly variable: what's wrong

Hello guys, This truly is a newbie question. I'm trying to make a loop to execute simultaneous commands indefinitely while using variable. Here is how my mess looks like (this is just an example): #!/bin/bash IP=`shuf -n 1 IP.txt` # I figured this would be easier to select random lines... (4 Replies)
Discussion started by: bobylapointe
4 Replies

7. Shell Programming and Scripting

Array Variable being Assigned Values in Loop, But Gone when Loop Completes???

Hello All, Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....? I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping through a string containing some of these "Illegal Characters". Now... (5 Replies)
Discussion started by: mrm5102
5 Replies

8. Shell Programming and Scripting

Attempting to pass my array as a nested parameter to loop. A little lost.

I want to pass this array as a parameter. IFS=$'\n' fortune_lines=($(fortune | fold -w 30 )) Inside of this line screen -p 0 -S ${SCREEN_SESSION} -X stuff "`printf "say ${fortune_lines}\r"`" And I am lost at this point. I am thinking something like this? Then make it loop.. ... (7 Replies)
Discussion started by: briandanielz
7 Replies

9. Shell Programming and Scripting

[Solved] How to increment and add variable length numbers to a variable in a loop?

Hi All, I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies
Log::Handler::Levels(3pm)				User Contributed Perl Documentation				 Log::Handler::Levels(3pm)

NAME
Log::Handler::Levels - All levels for Log::Handler. DESCRIPTION
Base class for Log::Handler. Just for internal usage and documentation. METHODS
Default log level debug() info() notice() warning(), warn() error(), err() critical(), crit() alert() emergency(), emerg() Checking for active levels is_debug() is_info() is_notice() is_warning(), is_warn() is_error(), is_err() is_critical(), is_crit() is_alert() is_emergency(), is_emerg() Special level fatal() Alternative for the levels "critical" - "emergency". is_fatal() Check if one of the levels "critical" - "emergency" is active. Special methods trace() This method is very useful if you want to add a full backtrace to your message. Maybe you want to intercept unexpected errors and want to know who called "die()". $SIG{__DIE__} = sub { $log->trace(emergency => @_) }; By default the backtrace is logged as level "debug". # would log with the level debug $log->trace('who called who'); If you want to log with another level then you can pass the level as first argument: $log->trace(info => $message); dump() If you want to dump something then you can use "dump()". The default level is "debug". my %hash = (foo => 1, bar => 2); $log->dump(\%hash); If you want to log with another level then you can pass the level as first argument: $log->dump($level => \%hash); die() This method logs the message to the output and then call "Carp::croak()" with the level "emergency" by default. $log->die('an emergency error here'); If you want to log with another level, then you can pass the level as first argument: $log->die(fatal => 'an emergency error here'); log() With this method it's possible to log messages with the log level as first argument: $log->log(info => 'an info message'); Is the same like $log->info('an info message'); and $log->log('an info message'); If you log without a level then the default level is "info". PREREQUISITES
Carp Data::Dumper EXPORTS
No exports. REPORT BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>. If you send me a mail then add Log::Handler into the subject. AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>. COPYRIGHT
Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-11-21 Log::Handler::Levels(3pm)
All times are GMT -4. The time now is 09:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy