Added ram percentage support
This commit is contained in:
parent
caa43a91ae
commit
3d5a3cbb8f
3 changed files with 38 additions and 0 deletions
28
scripts/ram_info.sh
Executable file
28
scripts/ram_info.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
get_percent()
|
||||
{
|
||||
case $(uname -s) in
|
||||
Linux)
|
||||
percent=$(free -m | awk 'NR==2{printf "%.1f%%\n", $3*100/$2}')
|
||||
echo $percent
|
||||
;;
|
||||
|
||||
Darwin)
|
||||
# TODO - Mac compatability
|
||||
;;
|
||||
|
||||
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
||||
# TODO - windows compatability
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
ram_percent=$(get_percent)
|
||||
echo "RAM $ram_percent"
|
||||
sleep 10
|
||||
}
|
||||
#run main driver
|
||||
main
|
Loading…
Add table
Add a link
Reference in a new issue