lejeczek
2017-Feb-21  10:51 UTC
[CentOS] that ever puzzling special chars escaping + rdiff-backup
hi everyone
a good basher around here?
I try in a script:
_rdiffBack="rdiff-backup -v5 --tempdir /tmp/ --no-eas 
--exclude-other-filesystems --exclude-symbolic-links"
_rdffiExclude="--exclude '**/~*' --exclude '**.tmp' 
--exclude-regexp '(.glusterfs|.trashcan|temp)'"
_execCom=${!2}
_sourceDir=${1}
_backupTo=${3}
__backMeUp() {
   for _sourceDir in ${_sourceDirs[@]}; do
     echo \$ ${_execCom} ${_rdffiExclude} ${_sourceDir}/ 
${_backupTo} \> ${_logFile} | ${_copyToLog}
     ${_execCom} ${_rdffiExclude} ${_sourceDir}/ 
${_backupTo} > ${_logFile} 2>&1
   done
}
case ${1} in
   rdiffThis)
   declare -a _sourceDirs=( /0-ALL.DATA/rdiffThis ); 
__backMeUp ${@}
   ;;
esac
this is a snippet which may look obscure but obvious is: 
rdiff-backup some data, just that.
And when I run it as a script
~]$ runme.sh rdiffThis _rdiffBack toHere
I see:
Fatal Error: Fatal Error: The file specification
     ''**'
cannot match any files in the base directory
You notice that the script echos what it is meant to 
execute, which suffice I copy&paste that echo in bash 
prompt... and it works!? No "Fatal Error"
And the problem seems to specifically be a shell pattern for 
--exclude. Take two --exclude out, having:
_rdffiExclude="--exclude-regexp '(.glusterfs|.trashcan|temp)'"
and script works when invoked, fine!
I've been fiddling around but failed to make rdiff-backup 
1.2.8 play along.
Must be something trivial, right?
b.w.
L
lejeczek
2017-Feb-21  12:31 UTC
[CentOS] that ever puzzling special chars escaping + rdiff-backup
On 21/02/17 10:51, lejeczek wrote:> hi everyone > > a good basher around here? > > I try in a script: > > _rdiffBack="rdiff-backup -v5 --tempdir /tmp/ --no-eas > --exclude-other-filesystems --exclude-symbolic-links" > _rdffiExclude="--exclude '**/~*' --exclude '**.tmp' > --exclude-regexp '(.glusterfs|.trashcan|temp)'"this cheat won't work, have it as a function instead> _execCom=${!2} > _sourceDir=${1} > _backupTo=${3} > > __backMeUp() { > for _sourceDir in ${_sourceDirs[@]}; do > echo \$ ${_execCom} ${_rdffiExclude} ${_sourceDir}/ > ${_backupTo} \> ${_logFile} | ${_copyToLog} > ${_execCom} ${_rdffiExclude} ${_sourceDir}/ > ${_backupTo} > ${_logFile} 2>&1 > done > } > > case ${1} in > rdiffThis) > declare -a _sourceDirs=( /0-ALL.DATA/rdiffThis ); > __backMeUp ${@} > ;; > esac > > this is a snippet which may look obscure but obvious is: > rdiff-backup some data, just that. > And when I run it as a script > > ~]$ runme.sh rdiffThis _rdiffBack toHere > > I see: > Fatal Error: Fatal Error: The file specification > ''**' > cannot match any files in the base directory > > You notice that the script echos what it is meant to > execute, which suffice I copy&paste that echo in bash > prompt... and it works!? No "Fatal Error" > And the problem seems to specifically be a shell pattern > for --exclude. Take two --exclude out, having: > > _rdffiExclude="--exclude-regexp '(.glusterfs|.trashcan|temp)'" > > and script works when invoked, fine! > I've been fiddling around but failed to make rdiff-backup > 1.2.8 play along. > Must be something trivial, right? > b.w. > L