Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

.functions: Add `fs`

…and remove the `fs` alias from `.aliases`.

Ref. #125.
  • Loading branch information...
commit 1b7314b0204c1deef419a72ceda0333039086cf0 1 parent acfad0c
@porada porada authored committed
Showing with 14 additions and 9 deletions.
  1. +0 −9 .aliases
  2. +14 −0 .functions
View
9 .aliases
@@ -74,15 +74,6 @@ alias c="tr -d '\n' | pbcopy"
# Recursively delete `.DS_Store` files
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
-# File size
-if stat -c '' . > /dev/null 2>&1; then
- # GNU `stat`
- alias fs="stat -c \"%s bytes\""
-else
- # OS X `stat`
- alias fs="stat -f \"%z bytes\""
-fi
-
# ROT13-encode text. Works for decoding, too! ;)
alias rot13='tr a-zA-Z n-za-mN-ZA-M'
View
14 .functions
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.