diff options
author | Dominik Porada <porada@mailinator.com> | 2012-08-23 11:22:20 +0200 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2012-08-23 12:55:39 +0200 |
commit | 1b7314b0204c1deef419a72ceda0333039086cf0 (patch) | |
tree | 234cb0831d267fddc2c1cd1c1e045757f91395c7 /.functions | |
parent | acfad0ca6a117341207f10a957e52deed38999c0 (diff) | |
download | dotfiles-1b7314b0204c1deef419a72ceda0333039086cf0.tar.gz dotfiles-1b7314b0204c1deef419a72ceda0333039086cf0.tar.bz2 dotfiles-1b7314b0204c1deef419a72ceda0333039086cf0.zip |
.functions: Add `fs`
…and remove the `fs` alias from `.aliases`.
Ref. #125.
Diffstat (limited to '.functions')
-rw-r--r-- | .functions | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -3,6 +3,20 @@ function mkd() { mkdir -p "$@" && cd "$@" } +# Determine size of a file or total size of a directory +function fs() { + if du -shb /dev/null > /dev/null 2>&1; then + local arg=-sbh + else + local arg=-skh + fi + if [[ -n "$@" ]]; then + du $arg -- "$@" + else + du $arg .[^.]* * + fi +} + # Use Git’s colored diff when available hash git &>/dev/null if [ $? -eq 0 ]; then |