Other Shell Features

Troubleshooting

Running your script


Running your script


Running your script


Quoting variables

    X=$Y $Z #is bad
    X="$Y $Z" is better

Deleting files

Never do:

    rm -rf $files_to_delete

Never, ever, ever do:

    rm -rf /$files_to_delete

Use this instead:

    [ -n "$files_to_delete" ] && rm -rf $files_to_delete

Best practices