File: whitespace-purge.sh

package info (click to toggle)
openmpi 5.0.8-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,692 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (25 lines) | stat: -rwxr-xr-x 815 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
#
# Copyright (c) 2015-2019 Intel, Inc.  All rights reserved.
# Copyright (c) 2015      Los Alamos National Security, LLC. All rights
#                         reserved
# Copyright (c) 2015 Cisco Systems, Inc.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

for file in $(git ls-files) ; do
    # check for the mime-type and do not follow symbolic links. this
    # will cause file to print application/x-symlink for the mime-type
    # allowing us to only have to check if the type is application to
    # skip sym links, pdfs, etc. If any other file types should be
    # skipped add the check here.
    type=$(file -b --mime-type -h $file)
    if test ${type::4} = "text" ; then
        # Eliminate whitespace at the end of lines
        perl -pi -e 's/\s*$/\n/' $file
    fi
done