Free tech support / small logo


Sneaky ls flags and bestcompress

Another hiccup in a script included in Wicked Cool Shell Scripts, one that's a subtle problem because it sometimes occurs because of a user-set LS_OPTIONS flag. Script #37, bestcompress, has the following sequence:
smallest="$(ls -l "$name" $Zout $gzout $bzout | \
awk '{print $5"="NR}' | sort -n | cut -d= -f2 | head -1)"

Dave's Answer: In some situations this may always report that compress has the best compression.

To fix this, simply change the flag '-l' to '-lf' (that is, add the '-f' flag) and it'll all work as expected.

You can ascertain if that'll fix the problem by just typing ls -l and ls -lf and compare the output.


Also check out:








Subscribe!
Never miss another Q&A article! Click to subscribe: Add to Google Reader Add to My Yahoo! Subscribe in NewsGator RDF XML
Comments · Add Comment
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you for all your efforts on this Web site by buying you a cup of coffee!
Rather amazingly, there are no comments on this article yet.

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Recent Entries


Search
I Need Help!
Need Help? Ask Dave Taylor!


© 2002 - 2012 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.