kalvn's links
Tag cloud
Picture wall
Daily
RSS Feed
  • RSS Feed
  • Daily Feed
  • Weekly Feed
  • Monthly Feed
Filters

Links per page

  • 20 links
  • 50 links
  • 100 links

Filters

Untagged links
Shell Script Best Practices — The Sharat's https://sharats.me/posts/shell-script-best-practices/
03/11/2022 08:31:38

Quelques règles intéressantes à connaître pour tout script Shell que vous écrivez.

#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
    set -o xtrace
fi

if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
    echo 'Usage: ./script.sh arg-one arg-two

This is an awesome bash script to make your life better.

'
    exit
fi

cd "$(dirname "$0")"

main() {
    echo do awesome stuff
}

main "$@"
shell script good-practice
3843 links, including 129 private
Shaarli - The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community - Theme by kalvn