0

I am running the script

#!/bin/bash -xv

billseqno=`sqlplus -s /@prod <<EOF
set heading off
set serveroutput off
select max(billseqno) from bc_run where control_group_ind is null;
EOF`

echo "$billseqno"


shark=`rsync --stats --dry-run -ax bill@shark:/home/$billseqno/ /home/temp/ | grep -i "number of files transferred" | cut -c30-`

whereby $billseqno represents a folder name and which is a number.

My problem is that the value of $billseqno is not passed to the rsync path.

Any suggestions what should I do?

Thanks

U880D
  • 8,601
  • 6
  • 24
  • 40
Assaf
  • 25
  • 2

2 Answers2

0

You may try to use

shark=$(rsync --stats --dry-run -ax bill@shark:/home/"${billseqno}"/ /home/temp/ | grep -i "number of files transferred" | cut -c30-)

and have a look into

U880D
  • 8,601
  • 6
  • 24
  • 40
0

I would advise you to change your SQL query to be as below :

billseqno=$( sqlplus -s replacethis/@prod <<-EOF
    set pagesize 0;
    set feedback off;
    set verify off;
    set heading off;
    select max(billseqno) 
    from bc_run 
    where control_group_ind is null;
    exit;
EOF )


shark=$(rsync --stats --dry-run -ax bill@shark:/home/"$billseqno"/ /home/temp/ | grep -i "number of files transferred" | cut -c30-)
Mahmoud Odeh
  • 942
  • 1
  • 7
  • 19