diff --git a/.gitignore b/.gitignore index 3597f5d..a55fdf5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ __pycache__/ .ipynb_checkpoints/ */data/* -*.env \ No newline at end of file +*.env +.metaflow diff --git a/shell_scripting/summarise-sln.sh b/shell_scripting/summarise-sln.sh new file mode 100755 index 0000000..60b25b1 --- /dev/null +++ b/shell_scripting/summarise-sln.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +usage() { + cat << EOF +Summarise the files in a directory + +Options: + -i --input-directory The input directory + -h --help Prints this help message and exits + +EOF +} + +while [ -n "$1" ]; do + case $1 in + -i | --input-directory) + shift + IN_DIR=$1 + ;; + -h | --help) + usage + exit 0 + ;; + *) + echo -e "Unknown option $1...\n" + usage + exit 1 + ;; + esac + shift +done + +if [ -z "$IN_DIR" ]; then + echo "Please provide an input directory." + usage + exit 1 +fi + +for FILE in $IN_DIR/*; do + [ -f "$FILE" ] || break + BYTES=$(wc -c < "$FILE") + echo "$(file $FILE) - has: $(echo $BYTES | tr -d ' ') bytes" +done + diff --git a/shell_scripting/summarise.sh b/shell_scripting/summarise.sh new file mode 100755 index 0000000..0b3380c --- /dev/null +++ b/shell_scripting/summarise.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +usage() { + cat << EOF +Summarise the files in a directory + +Options: + -i --input-directory The input directory + -h --help Prints this help message and exits + +EOF +} + +while [ -n "$1" ]; do + case $1 in + -i | --input-directory) + shift + IN_DIR=$1 + ;; + -h | --help) + usage + exit 0 + ;; + *) + echo -e "Unknown option $1...\n" + usage + exit 1 + ;; + esac + shift +done + +if [ -z "$IN_DIR" ]; then + echo "Please provide an input directory." + usage + exit 1 +fi + +for FILE in $IN_DIR/*; do + [ -f "$FILE" ] || break + BYTES=$(wc -c < "$FILE") + echo "$(file $FILE) - has: $BYTES bytes" +done