source: dynamico_lmdz/simple_physics/phyparam/bash/beautify.sh @ 4236

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

simple_physics : some Python bindings

  • Property svn:executable set to *
File size: 536 bytes
Line 
1#!/bin/bash
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
8for x in $* ; do
9    # indent source file using emacs in batch mode
10    # following standard settings of emacs f90-mode
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
12    # remove blank lines at end of file
13    sed  -e :a -e '/^\n*$/{$d;N;};/\n$/ba' $x  > $TMP
14    cp -f $TMP $x
15done
16
17rm -f $TMP
Note: See TracBrowser for help on using the repository browser.