Trying to use rsync options (bash arrays) in script

  • So I have a rsync script to copy files from my main computer onto my Libreelec external hard drive every time I boot up the computer.

    The script works fine, but now I want to expand it and use rsync flags so it is a bit reasonable.

    The following doesn't work. It should work, as it works fine on MacOS under bash:

    It looks like the following lines aren't allowed on Libreelec bash

    Code
    export opt_ssh=(ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no)
    export opt_rsync=(--progress -rptuv --delete)

    What should I do instead?


    Added bash arrays to the title of the thread, since that seems to be the problem.

    Edited once, last by mmcmonster: Merged a post created by mmcmonster into this post. (December 29, 2024 at 1:45 PM).


  • Added bash arrays to the title of the thread, since that seems to be the problem.

    Don't use them?

    Code
    export opt_ssh="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
    export opt_rsync="--progress -rptuv --delete"
    rsync -e "${opt_ssh}" ${opt_rsync} ...