Skip to content

Instantly share code, notes, and snippets.

@Skardian
Created September 26, 2016 14:38
Show Gist options
  • Select an option

  • Save Skardian/231b3f8f3b9159cfd031ba22aeb55a19 to your computer and use it in GitHub Desktop.

Select an option

Save Skardian/231b3f8f3b9159cfd031ba22aeb55a19 to your computer and use it in GitHub Desktop.
Ejercicio BASH Generación DevOps
#!/usr/bin/env bash
# while [[ $1 ]]; do # Opción Fabiano
# while (( $1 )); do # Opción Jesús
while [ "$#" -gt 1 ]; do
# echo $1
case $1 in
-d)
DIR=$2
shift
;;
-f)
FILE=$2
shift
;;
*)
;;
esac
shift
done
DIR=${DIR:-.}
FILE=${FILE:-salida.txt}
# echo $DIR
# echo $FILE
ls -1 ${DIR} > ${FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment