Commit 0986a424 authored by Jason Rogers's avatar Jason Rogers

add TBytes.sh

parent 0b92a704
#!/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"
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment