inline tbytes

pull/2/head
Jason Rogers 11 years ago
parent 8183877640
commit 01dc116a54

@ -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

@ -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
Loading…
Cancel
Save