clfs-2.1
clfs-3.0.0-systemd
clfs-3.0.0-sysvinit
systemd
sysvinit
Last change
on this file since a5f68ec 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
|
Line | |
---|
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 |
|
---|
6 | NAME=`basename $0`
|
---|
7 |
|
---|
8 | if [ -z "$1" ]; then
|
---|
9 | echo "USAGE: $NAME -d directory"
|
---|
10 | echo " $NAME -f file"
|
---|
11 | exit;
|
---|
12 | fi
|
---|
13 |
|
---|
14 | case "$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 |
|
---|
43 | esac
|
---|
Note:
See
TracBrowser
for help on using the repository browser.