• [^] # Re: Une petite erreur s'est glissée dans le script de backup ;-)

    Posté par (site web personnel) . En réponse au journal Mes activités open sources / libres récentes. Évalué à 10.

    Un outil qui peut aider :

    $ shellcheck script_backup.sh 
    In script_backup.sh line 12:
    bck_suffix="$(expr $(date +'%d') % 10)_$(date +'%H')"
     ^-- SC2003: expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
     ^-- SC2046: Quote this to prevent word splitting.
    In script_backup.sh line 52:
    if [ -d '${bck_snapshot}' ] ; then
     ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
    $ shellcheck --version
    ShellCheck - shell script analysis tool
    version: 0.5.0
    license: GNU General Public License, version 3
    website: https://www.shellcheck.net