I'd like to share a bit of bash script that I wrote yesterday that I am both very proud of and very disturbed by:
DfLine=$(df -h /misc/backup | tail -1)
# convert DfLine into a bash array...
DfLine=(${DfLine// / })
echo -n ${DfLine[3]}
echo " free space remaining on /misc/backup"
So basically I did a perl split on whitespace
and stuffed the results into an array. Actually I'm think
that's a split on " *", not whitespace as I
suspect it
wouldn't work on tabs. I didn't test that though.
Also I think it should be possible to do the command
substitution and the expansion of $DfLine in
one go but all
the $({$({${{ started to make my head hurt so I
stopped there.
Inspiration from this unix.com page.
This is probably a pretty good indication that it's time to re-write the script in perl.
