add TBytes.sh

This commit is contained in:
Jason Rogers 2013-06-05 12:50:11 -04:00
parent 0b92a704e1
commit 0986a42450
2 changed files with 40 additions and 21 deletions

18
themes/jacaetevha/TBytes.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
#Sum the number of bytes in a directory listing
TBytes=0
# swap the next two lines in order to get a summary with the sizes of directories as well
#for Bytes in $(ls -l | awk '{ print $5 }')
for Bytes in $(ls -l | grep "^-" | awk '{ print $5 }')
do
let TBytes=$TBytes+$Bytes
done
Total=$(echo -e "scale=3 \n$TBytes/1048576 \nquit" | bc)
Units=" Mb"
if [[ TBytes -lt 1048576 ]]
then
Total=$(echo -e "scale=3 \n$TBytes/1048 \nquit" | bc)
Units=" Kb"
fi
echo -n "$Total$Units"

View File

@ -1,27 +1,28 @@
function fish_prompt function fish_prompt
set_color yellow set -l script_dir (dirname (status -f))
printf '%s' (whoami) set_color yellow
set_color normal printf '%s' (whoami)
printf ' at ' set_color normal
printf ' at '
set_color magenta set_color magenta
printf '%s' (hostname|cut -d . -f 1) printf '%s' (hostname|cut -d . -f 1)
set_color normal set_color normal
printf ' in ' printf ' in '
set_color $fish_color_cwd set_color $fish_color_cwd
printf '%s ' (prompt_pwd) printf '%s ' (prompt_pwd)
set_color blue set_color blue
printf '%s' (/Users/jrogers/bin/TBytes.sh) printf '%s' ($script_dir/TBytes.sh)
set_color normal set_color normal
printf '%s' (__fish_git_prompt) printf '%s' (__fish_git_prompt)
# Line 2 # Line 2
echo echo
if test $VIRTUAL_ENV if test $VIRTUAL_ENV
printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal) printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal)
end end
printf '↪ ' printf '↪ '
set_color normal set_color normal
end end