Maybe the df manual can help you: -P, --portability use the POSIX output format On 09/26/2010 01:02 AM, Jim Angstadt wrote: > Hi All, > > This is my first post to centos-docs. I've read several months of > archives, but, this may be too trivial. > > Re: http://wiki.centos.org/TipsAndTricks/EncryptedFilesystem/Scripts > > This line: > > FREE_SPACE=$(df -m $SECRET_PATH |grep / | awk '{ print $4 }') > > gave me a problem due to line wrapping in df. For example: > > $ df -m /home/ja/verify/ > Filesystem 1M-blocks Used Available Use% Mounted on > /dev/mapper/VolGroup00-LogVol00 > 589333 289168 269746 52% / > > So, $4 is 52% rather than 269746. > > The '/dev/mapper/VolGroup00-LogVol00' term is from a fresh install, > so, perhaps others have this same name. > > This change worked for me: > FREE_SPACE=$(${DF} -m ${PATH} | ${GREP} / \ > | ${TR} "\n" ' ' | ${TR} -s ' ' | ${CUT} -d' ' -f4) > > Note the reformating onto 1 line with TR. The remainder could be what > I have, the original awk statement, or whatever. Thanks for your > consideration. > > JIm > _______________________________________________ > CentOS-docs mailing list > CentOS-docs at centos.org > http://lists.centos.org/mailman/listinfo/centos-docs > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 262 bytes Desc: OpenPGP digital signature Url : http://lists.centos.org/pipermail/centos-docs/attachments/20100926/f7a05fe7/attachment.bin