inline tbytes

This commit is contained in:
Jason Rogers 2013-06-06 00:18:31 -04:00
parent 8183877640
commit 01dc116a54
2 changed files with 13 additions and 15 deletions

View File

@ -1,7 +1,17 @@
function fish_prompt
set -l script_dir (dirname (status -f))
. $script_dir/tbytes.fish
function tbytes -d 'calculates the total size of the files in the current directory'
set -l tBytes (ls -al | grep "^-" | awk 'BEGIN {i=0} { i += $5 } END { print i }')
if test $tBytes -lt 1048576
set -g total (echo -e "scale=3 \n$tBytes/1048 \nquit" | bc)
set -g units " Kb"
else
set -g total (echo -e "scale=3 \n$tBytes/1048576 \nquit" | bc)
set -g units " Mb"
end
echo -n "$total$units"
end
function fish_prompt
set_color yellow
printf '%s' (whoami)
set_color normal

View File

@ -1,12 +0,0 @@
function tbytes -d 'calculates the total size of the files in the current directory'
set -g tBytes (ls -al | grep "^-" | awk 'BEGIN {i=0} { i += $5 } END { print i }')
if test $tBytes -lt 1048576
set -g total (echo -e "scale=3 \n$tBytes/1048 \nquit" | bc)
set -g units " Kb"
else
set -g total (echo -e "scale=3 \n$tBytes/1048576 \nquit" | bc)
set -g units " Mb"
end
echo -n "$total$units"
end