source: dynamico_lmdz/simple_physics/bash/beautify.sh @ 4235

Last change on this file since 4235 was 4235, checked in by dubos, 5 years ago

simple_physics : DYNAMICO driver

  • Property svn:executable set to *
File size: 536 bytes
RevLine 
[4229]1#!/bin/bash
[4235]2
3# NOTE : sed -i seems to work differently on GNU and OSX systems
4# a temporary file is used instead
5
6TMP=$(mktemp)
7
[4229]8for x in $* ; do
9    # indent source file using emacs in batch mode
10    # following standard settings of emacs f90-mode
[4233]11    emacs -batch $x --eval '(f90-mode)' --eval '(indent-region (point-min) (point-max) nil)' --eval '(delete-trailing-whitespace)' -f save-buffer 2>/dev/null
[4229]12    # remove blank lines at end of file
[4235]13    sed  -e :a -e '/^\n*$/{$d;N;};/\n$/ba' $x  > $TMP
14    cp -f $TMP $x
[4229]15done
[4235]16
17rm -f $TMP
Note: See TracBrowser for help on using the repository browser.