Search code examples
linuxbashunixargumentsrsync

How to pass an argument in a Bash script?


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


Solution

  • 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