An adaptation of this script might work in that regard. It was a shell script I hacked together to reformat occasionally as I worked on things. Given one or more files on the command line, it looks to see if there is a .tdy version of the file present (creating an empty one if not), checks if the current version and the .tdy version differ, and if so, performs a tidy (setting the lines 123 characters-personal preference), not replacing the original if a .ERR file was produced. The .tdy file was also left in place for future comparison.
PERLTIDY='/usr/local/bin/perltidy -l 123 '
if [ $# -gt 0 ]
echo Command line: $0 $@
for file in $@
if [ ! -e $file.tdy ]
if [ `$DIFF -q $file $file.tdy | $WC -l` -gt 0 ]
if [ -e $file.ERR ]
echo Error detected-not replacing
$CP -v $file.tdy $file
echo Skipping $file - perltidy on file not necessary
echo Usage: $0 filename
Update (20 Jan 2004): Added absolute paths to utilities used, to prevent issues with pathing.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||