Linux script question

This doesn’t work, the config file isn’t created

localRepoPath="/mnt/int_02_crypt/backup"

repoOpts="--config-file=\"/root/.config/kopia/repository_local.config\" "
repoOpts+="--no-check-for-updates "
repoOpts+="--block-hash=BLAKE3-256-128"

kopia repository create filesystem --path="${localRepoPath}" $repoOpts

This works (but I’d prefer to create a list of options by concatenating^^):

localRepoPath="/mnt/int_02_crypt/backup"

repoOpts="--no-check-for-updates "
repoOpts+="--block-hash=BLAKE3-256-128"

kopia repository create filesystem --path="${localRepoPath}" --config-file="/root/.config/kopia/repository_local.config" $repoOpts

Any idea how to get the first version to work as expected?

Try:
repoOpts="--config-file=/root/.config/kopia/repository_local.config "

Thanks ted.

Ofc this would work. But what if a path contains a space or a char that would need to be escaped (like a “@” or “!”)?

Because I’d like to do the same for e.g. the

--cache-directory=

option e.g. like this:

kopiaCache="/mnt/int_02_crypt/!caches"
localRepoCache="${kopiaCache}/!repository_local"
...
repoOpts+="--cache-directory=\"${localRepoCache}\" "
...

and this wouldn’t work with just removing the escaped quotation marks…

Seems this is too complicated…

I’ll use something like this:

kopia repository create filesystem --path="${localRepoPath}" --config-file="${cfgFile}" --cache-directory="${localRepoCache}" ${repoOpts}

Where ${repoOpts} only contains those options that don’t require a path / any escaping in a string…