I want to display server load, disk space, usage and memory usage in bash script.
But when I try
echo "Memory usage:"
memory_usage=$ free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }'
echo $memory_usage
this and run the script using ./test.sh it gives me the error:
free command not found
which free?var=$(command). Yourvar=$ commandis wrong - note the space and the lack of parentheses around the command.freepackage installed. Check How to add more commands to Git Bash Shell.