source: BOOK/editor-tools/Clean-spaces.sh@ 2cbdaf1

systemd
Last change on this file since 2cbdaf1 was 3f8be484, checked in by Jim Gifford <clfs@…>, 19 years ago

r627@server (orig r625): jim | 2005-10-31 12:59:34 -0800
Import of Cross-LFS Book

  • Property mode set to 100644
File size: 700 bytes
RevLine 
[3f8be484]1#!/bin/bash -e
2
3# This script will clean the trailing spaces on the given file
4# or in all XML files under the given directory.
5
6NAME=`basename $0`
7
8if [ -z "$1" ]; then
9 echo "USAGE: $NAME -d directory"
10 echo " $NAME -f file"
11 exit;
12fi
13
14case "$1" in
15 -d )
16
17 if [ -z "$2" ]; then
18 echo "A directory is needed"
19 exit
20 fi;
21
22 for filename in `find $2 -name "*.xml"`; do
23 sed -i -e "s/[[:space:]]\+$//" "${filename}"
24 done;
25 exit;;
26
27 -f )
28
29 if [ -z "$2" ]; then
30 echo "A filename is needed"
31 exit
32 fi
33
34 sed -i -e "s/[[:space:]]\+$//" $2
35 exit;;
36
37 * )
38
39 echo "USAGE: $NAME -d directory"
40 echo " $NAME -f file"
41 exit;;
42
43esac
Note: See TracBrowser for help on using the repository browser.