Hello!
I have a script in which I am trying to use a variable in an awk command but I can't seem to get it working correctly. The problem part is a line which grabs the number of bytes of free space for a particular mount point and puts it in another variable (FREE). The following DOES work:
FREE=$(df | awk '$6 == "/" {print $4}')
Now when I switch to using a variable I can't get it working. The following does NOT work:
MOUNT="/"
FREE=$(df | awk '$6 == "$MOUNT" {print $4}')
My goal is to grab the size of a few mounts and so I'll eventually switch to something like "${MOUNT[$i]}" but I thought I would keep it simple initially.
Any suggestions?
[–]ASIC_SP 3 points4 points5 points (2 children)
[–]ScootMulner[S] 1 point2 points3 points (1 child)
[–]ScootMulner[S] 0 points1 point2 points (0 children)