From 2eeb1ef6c8fd816ec693f3d320e3b0bbf75555d8 Mon Sep 17 00:00:00 2001 From: Chris Coley <chris@codingallnight.com> Date: Mon, 5 Oct 2015 09:10:05 -0700 Subject: [PATCH] Making the color alias into a function. Also adding an alias for all the custom function so that they show up in the output of the alias command. --- bash_aliases | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/bash_aliases b/bash_aliases index 346002c..81f3013 100644 --- a/bash_aliases +++ b/bash_aliases @@ -54,35 +54,40 @@ alias dume='du -h --exclude="*.git*" | sort -h' # Make free output more human friendly alias free='free -mt' -# Print a color chart -alias color=' - for x in 0 1 4 5 7 8; - do for i in `seq 30 37`; - do for a in `seq 40 47`; - do echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "; - done; - echo; - done; - done; - echo "";' - ################### # Functions # ################### # Count the number of files in a directory and its sub-directories +alias count='count # Count the number of files in a directory and its sub-directories' function count { find $1 -type f | wc -l } # Show a histogram output of commands in history +alias hist='hist # Show a histogram output of commands in history' function hist { - history | awk "{print $2}" | sort -n | uniq -c | sort -n | tail + history | awk '{print $2}' | sort -n | uniq -c | sort -n | tail } # Make a directory, then cd into it +alias mcd='mcd # Make a directory, then cd into it' function mcd { mkdir -pv $1 cd $1 pwd } + +# Print a color chart +alias color='color # Print a color chart' +function color { + for x in 0 1 4 5 7 8; do + for i in `seq 30 37`; do + for a in `seq 40 47`; do + echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "; + done; + echo; + done; + done; + echo ""; +} -- GitLab