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
set_color yellow
printf '%s' (whoami)
set_color normal
printf ' at '
set -l script_dir (dirname (status -f))
set_color yellow
printf '%s' (whoami)
set_color normal
printf ' at '
set_color magenta
printf '%s' (hostname|cut -d . -f 1)
set_color normal
printf ' in '
set_color magenta
printf '%s' (hostname|cut -d . -f 1)
set_color normal
printf ' in '
set_color $fish_color_cwd
printf '%s ' (prompt_pwd)
set_color blue
printf '%s' (/Users/jrogers/bin/TBytes.sh)
set_color normal
printf '%s' (__fish_git_prompt)
set_color $fish_color_cwd
printf '%s ' (prompt_pwd)
set_color blue
printf '%s' ($script_dir/TBytes.sh)
set_color normal
printf '%s' (__fish_git_prompt)
# Line 2
echo
if test $VIRTUAL_ENV
printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal)
end
printf '↪ '
set_color normal
# Line 2
echo
if test $VIRTUAL_ENV
printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal)
end
printf '↪ '
set_color normal
end