help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using different options to run rsync


From: lisa-asket
Subject: Using different options to run rsync
Date: Mon, 19 Jul 2021 14:43:26 +0200 (CEST)

Have various options to run `rsync` using a bash srcipt.  



I am duplicating code here, all those -av, --progress, $source, $destin are the 
same in both branches.

Perhaps it is best to avoid that.  Since I am running `bash`, I could collect 
the arguments to an array.



Would that be an improved strategy?


  if (( filetr_dryrun == 1 )); then 

    echo "rsync -av --progress --dry-run --log-file=$logfl"
    echo "  $source $destin"
    rsync -av --progress --dry-run --log-file="$logfl" "$source" "$destin"

  elif (( filetr_exec == 1 )); then
      
    # use rsync archive option -a (equivalent to -rlptgoD)
    echo "rsync -av --progress --log-file=$logfl $source $destin"
    rsync -av --progress --log-file="$logfl" "$source" "$destin"

  else

    echo "rsync -av --progress --log-file=$logfl $source $destin"
      
  fi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]