A function for sorting contents of a directory by storage consumed (sorry for lack of comments throughout). I must admit, I’m particularly pleased with this one. (This is for MacOS):
#!/usr/bin/env bash
function szup() {
description='
#: Title: szup
#: Synopsis: sort all items within a directory according to size
#: Date: 2016-05-30
#: Version: 0.0.5
#: Options: -h | --help: print short usage info
#: : -v | --version: print version number
'
#!/usr/bin/env bash
function szup() {
description=' #: Title: szup #: Synopsis: sort all items within a directory according to size #: Date: 2016-05-30 #: Version: 0.0.5 #: Options: -h | --help: print short usage info #: : -v | --version: print version number '
funcname=$(echo "$description" | grep '^#: Title: ' | sed 's/#: Title: //g') version=$(echo "$description" | grep '^#: Version: ' | sed 's/#: Version: //g') updated="$(echo "$description" | grep '^#: Date: ' | sed 's/#: Date: //g')"