mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-03 20:25:30 +00:00
feat: add Dotbot
This commit is contained in:
18
functions/fs.sh
Executable file
18
functions/fs.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
# Determine size of a file or total size of a directory
|
||||
|
||||
fs() {
|
||||
# Check if 'du' supports the -b option
|
||||
if du -b /dev/null > /dev/null 2>&1; then
|
||||
arg="-sbh"
|
||||
else
|
||||
arg="-sh"
|
||||
fi
|
||||
|
||||
# If arguments are provided, use them; otherwise, use current directory
|
||||
if [ $# -gt 0 ]; then
|
||||
du $arg -- "$@"
|
||||
else
|
||||
# Use find to handle hidden files and directories
|
||||
find . -maxdepth 1 -print0 | xargs -0 du $arg | sort -h
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user