Create, validate and using dynamic variables in Bash scripting
Hi All,
I am really struggling to solve this problem, this might be small but I am not able to, can somebody help me?
I have few directories and these directories receives text files in large amount with in fraction of seconds. So I just want to send all the files in current directory to another server (Which is AS400) via FTP( I have to use FTP, no other tool). While sending file/s, if any failure occurs, need to retry 4 times. If still failures after 4th time, file should me moved to a directory called RETRYFAILED in same location. Once I moved to destination, I need to change the extension from txt to iur.
Directory structure is same at source and destination servers.
My problem is,
1. How can I split a single script which contains repeated piece of code below? 2. In Following code, I am taking one variable which includes current file name, retry$currentfile, but its not working as expected. That is not creating and initilazing say for example
currentfile="abcd.txt"
i'm creating and initializing dynamic variable like this - retryabcd=0
and checking if this variable value is less than 5, i'm reprocessing file, otherwise moving file to RETRYFAILED Directory in same location
For this I am using following code:
Can some body please help me?
Thanks & Regards,
VasuBabu Kukkapalli.
Last edited by Don Cragun; 01-11-2014 at 02:38 AM..
Reason: Add CODE tags.
I have created one file that contains all the necessary info in it to create a download link. In each of the lines /results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67... (8 Replies)
Hi ,
i am unable to generate dynamic variables can any one please help me on the below issue
j=1
{record_count_"$j"}=`db2 -xselect substr\(job_name,24\) rec_count from $libname.audit_table_nrt where job_name like \'DATAMART_DEL_RUN%\' and STS_FLAG=\'E\' and seq_no=$i`
echo " record... (3 Replies)
Hi all,
I want to dynamically set variables in a bash script. I made a naive attempt in a while loop that hopefully can clarify the idea.
n=0; echo "$lst" | while read p; do n=$(($n+1)); p"$n"="$p"; done
The error message is:
bash: p1=line1: command not found
bash: p2=line2: command... (8 Replies)
Hi all,
This is my Script
#!/bin/bash
current_date=`date +%d-%m-%Y_%H.%M.%S`
Date=`date +%d%m%Y`
Lfriday=`date +%d%m%Y -d last-friday`
RootPath=/var/domaincount/com
mysql zonefile<<EOFMYSQL
CREATE TABLE com$Date(domain VARCHAR(255),col2 VARCHAR(255),col3 VARCHAR(255),col4... (10 Replies)
Hi,
I need some direction with the following. The below code is semi-psuedo code which will hopefully make it easier to understand what I am trying to achieve:
for i in `echo ${testarray
}`
do
let c=c+1
eval "first$c=$i"
while... (4 Replies)
Hey, im trying to validate a user input and need some help. The input needs to be just a single letter. Im using a case to so this eg:
read answer
case $answer in
*) echo "OK"
;;
*) echo "This is a number"
read answer
;;
*) echo... (2 Replies)
Hi
Can you help me validate 2 variables?The first is an input date from the user and should be like this (yyyy-mm-dd). The second variable is an input time from the user and should be like this(hh:mm).When the input is wrong i want to give the chance to the user to insert again the date or time... (8 Replies)
I am new to unix and the following problem is bugging me.:confused:
var1="hello1"
var2="hello2"
var3="hello3"
counter=1
while
do
echo $var$counter
done
the idea here is to display the value of "var" based on the counter.
I am using the korn shell. I used array here but the... (4 Replies)
are they any server variables in bash/SSH scripting as is in PHP or Perl, for example in PHP:
$_SERVER or $_SERVER
I'm trying to retrieve the absolute path of an .SH script I'm running
thank you (6 Replies)