'Trying to create a bash script that gives disk percentage using grep
I'm trying to make a bash script to pull the disk percentage and then output it to a file. I have to use grep -o to take the output and then send it to a file. How would I accomplish this? Any and all guidance is extremely appreciated! Here's what I have so far:
#!/bin/bash
df -h /dev/sda1|tail -n +2
grep -o '[0-9]+%'
Summary:
Need to have grep output the %disk full of /dev/sda1 using the first command and then send it to /var/logs/disk.log
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|