4087 shaares
317 liens privés
317 liens privés
7 résultats
taggé
bash
à tester
set -e
while [ '-' == "${1:0:1}" ] ; do
case "${1}" in
-h|--help)
echo "${HELP}"
exit 0
;;
-u|--unlock)
_unlock_script
exit 0
;;
-v|--verbose)
VERBOSE="y"
option_sub_script="${option_sub_script} --verbose"
;;
-i|--interactive)
ALWAYS_AUTO="n"
option_sub_script="${option_sub_script} --interactive"
;;
--)
shift
break
;;
*)
echo "Invalid \"${1}\" option. See ${0} --help"
exit 1
;;
esac
shift
done
Here is my Katas for creating BASH programs that work. Nothing is new here, but from my experience pepole like to abuse BASH, forget computer science …
du --max-depth=1 2> /dev/null | sort -n -r | head -n20
ou mieux :
du -h --max-depth=1 2> /dev/null | sort -h -r | head -n20
automatically detects problems with sh/bash scripts and commands.
tout est dans le titre ;)
ou par quoi remplacer le bon vieux ipconfig...
echo -e '!\nThat was a bad idea. Don'"'"'t copy code from websites you don'"'"'t trust!