annotate bin/nashorn/fixwhitespace.sh @ 47216:71c04702a3d5

8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
author erikj
date Tue, 12 Sep 2017 19:03:39 +0200
parents nashorn/bin/fixwhitespace.sh@ff5dd57a40f2
children
rev   line source
lagergren@26982 1 #!/bin/bash
lagergren@26982 2 #
lagergren@26982 3 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
lagergren@26982 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
lagergren@26982 5 #
lagergren@26982 6 # This code is free software; you can redistribute it and/or modify it
lagergren@26982 7 # under the terms of the GNU General Public License version 2 only, as
lagergren@26982 8 # published by the Free Software Foundation.
lagergren@26982 9 #
lagergren@26982 10 # This code is distributed in the hope that it will be useful, but WITHOUT
lagergren@26982 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
lagergren@26982 12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
lagergren@26982 13 # version 2 for more details (a copy is included in the LICENSE file that
lagergren@26982 14 # accompanied this code).
lagergren@26982 15 #
lagergren@26982 16 # You should have received a copy of the GNU General Public License version
lagergren@26982 17 # 2 along with this work; if not, write to the Free Software Foundation,
lagergren@26982 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
lagergren@26982 19 #
lagergren@26982 20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
lagergren@26982 21 # or visit www.oracle.com if you need additional information or have any
lagergren@26982 22 # questions.
lagergren@26982 23 #
lagergren@26982 24
lagergren@26982 25 fix() {
lagergren@26982 26 #convert tabs to spaces
lagergren@26982 27 find . -name $1 -exec sed -i "" 's/ / /g' {} \;
lagergren@26982 28 #remove trailing whitespace
lagergren@26982 29 find . -name $1 -exec sed -i "" 's/[ ]*$//' \{} \;
lagergren@26982 30 }
lagergren@26982 31
lagergren@26982 32 if [ ! -z $1 ]; then
lagergren@26982 33 fix $1;
lagergren@26982 34 else
lagergren@26982 35 fix "*.java"
lagergren@26982 36 fix "*.js"
lagergren@26982 37 fi