Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
0ecde036
Commit
0ecde036
authored
Jun 05, 2013
by
Jason Rogers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
port TBytes.sh to tbytes.fish
parent
0986a424
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
19 deletions
+15
-19
themes/jacaetevha/TBytes.sh
themes/jacaetevha/TBytes.sh
+0
-18
themes/jacaetevha/fish_prompt.fish
themes/jacaetevha/fish_prompt.fish
+3
-1
themes/jacaetevha/tbytes.fish
themes/jacaetevha/tbytes.fish
+12
-0
No files found.
themes/jacaetevha/TBytes.sh
deleted
100755 → 0
View file @
0986a424
#!/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
\n
quit"
| bc
)
Units
=
" Mb"
if
[[
TBytes
-lt
1048576
]]
then
Total
=
$(
echo
-e
"scale=3
\n
$TBytes
/1048
\n
quit"
| bc
)
Units
=
" Kb"
fi
echo
-n
"
$Total$Units
"
themes/jacaetevha/fish_prompt.fish
View file @
0ecde036
function fish_prompt
function fish_prompt
set -l script_dir (dirname (status -f))
set -l script_dir (dirname (status -f))
. $script_dir/tbytes.sh
set_color yellow
set_color yellow
printf '%s' (whoami)
printf '%s' (whoami)
set_color normal
set_color normal
...
@@ -13,7 +15,7 @@ function fish_prompt
...
@@ -13,7 +15,7 @@ function fish_prompt
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' (
$script_dir/TBytes.sh
)
printf '%s' (
tbytes
)
set_color normal
set_color normal
printf '%s' (__fish_git_prompt)
printf '%s' (__fish_git_prompt)
...
...
themes/jacaetevha/tbytes.fish
0 → 100755
View file @
0ecde036
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment