[Insight-developers] Followup: using uncrustify
Matthew McCormick (thewtex)
matt at mmmccormick.com
Wed Dec 15 18:43:22 EST 2010
On Wed, Dec 15, 2010 at 4:59 PM, Michael Stauffer (Circular Logic)
<mstauff at verizon.net> wrote:
> Thanks!
>
> I'm on OSX and there's a couple things:
>
> - the backticks don't work for the assignment of MYTEMP
That's interesting. How about
MYTEMP=$(tempfile)
or maybe 'tempfile' is not installed. Another option is 'mktemp'.
The whole MYTEMP issue was an attempting to make it cross platform, to
which I apparently failed. If it is known that you have GNU sed, then
'sed -i' can just be used to edit the file.
>
> - the script also removes trailing t's. Doh! I remember some issues in
> the past with OSX and sed and control characters, I'll try to fix it
> tomorrow.
That's weird. Please let me know what you come up with.
Regards,
Matt
>
> Cheers,
> Michael
>
>>-----Original Message-----
>>From: matthew.m.mccormick at gmail.com
>>[mailto:matthew.m.mccormick at gmail.com] On Behalf Of Matthew
>>McCormick (thewtex)
>>Sent: Wednesday, December 15, 2010 12:43 PM
>>To: Michael Stauffer (Circular Logic)
>>Cc: ITK-dev-list
>>Subject: Re: [Insight-developers] Followup: using uncrustify
>>
>>Hi Michael,
>>
>>Great to here you got it working. Here is a script I use to
>>remove trailing whitespace:
>>
>>#!/bin/bash
>>
>># strip trailing whitespaces from filenames sent to stdin or
>>as args # Matt McCormick (thewtex) <matt at mmmccormick.com> #
>>created 2008 May 01
>>
>>MYTEMP=`tempfile`
>>trap 'rm -f $MYTEMP' SIGINT SIGTERM
>>
>>stripit() {
>> echo "stripping $1"
>> sed 's/[ \t]*$//' "$1" > $MYTEMP
>> cp $MYTEMP "$1"
>>}
>>
>>if [ $# -gt 0 ]; then
>> while [ "$1" != "" ]; do
>> stripit $1
>> shift
>> done
>>else
>> while read; do
>> stripit $REPLY
>> done
>>fi
>>
>>rm $MYTEMP
>>
More information about the Insight-developers
mailing list