Skip to content

Rework mft_renderfarm.sh

Christian Aribaud requested to merge mft_renderfarm_rework_proposal into main

Commit N°1

Usually, we just need a single double quote for a single argument, e.g.touch "${FOO}"/"${BAR}" can be simplified to touch "${FOO}/BAR" and echo "Hello ""${NAME}" can be simplified to "Hello ${NAME}". I think this makes the variables easier to read.

The exception is when you actually want spliting, i.e. bash interpreting stars, e.g. rm "${FOO}"/"${BAR}"/*.kra cannot be simplified to rm "${FOO}/${BAR}/*.kra" (but can be simplified to rm "${FOO}/${BAR}"/*.kra).

Commit N°2

Fix potential splitting in _deleteSecure()

If $1 was set to "foo/*", then not double-quoting the variable could lead to unintentional spliting.

Commit N°3

Remove superfluous call to echo ... | sed ... to determine filename without extension

It seems $(echo ${kraFile}|sed 's/\(.*\)\..\+/\1/') and $(echo ${svgFile}|sed 's/\(.*\)\..\+/\1/') are just ways to get the file names without extensions, but they are already computed beforehand.

Commit N°4

Unify subcommands call using $(...)

Back-ticks are legacy, using $(...), which is already used elsewhere in the script, makes it easier to read.

Commit N°5

Removing unused variables

  • $log_file is undefined, cannot log to it
  • mdFile is unused, no need to assign it
  • ${database} is undefined, _makeDir "${dirPath}/${database}" is equivalent to _makeDir "${dirPath}/"
Edited by Christian Aribaud

Merge request reports