-
Notifications
You must be signed in to change notification settings - Fork 2
/
rm-tail-ctrl-M.sh
executable file
·49 lines (39 loc) · 1.66 KB
/
rm-tail-ctrl-M.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
################################################################################
# #
# Remove tail ^M from source file #
# #
################################################################################
#-------------------------------------------------------------------------------
# 1) Global variables
#-------------------------------------------------------------------------------
# Script name and location of this script
scriptName="rm-tail-ctrl-M.sh"
#-------------------------------------------------------------------------------
# 2) Usage
#-------------------------------------------------------------------------------
function usage(){
echo
echo "Usage:"
echo "${scriptName}"
echo "${scriptName} <files>"
echo
echo "${scriptName}"
echo " Show the usage of this script."
echo
echo "${scriptName} <files>"
echo " Specify the files you want to process. In order to reach the file,"
echo " absolute path or relative path should be included in <files>."
echo
}
#-------------------------------------------------------------------------------
# 3) Check script options
#-------------------------------------------------------------------------------
if [ $# == 0 ]; then
usage
exit 1
fi
#-------------------------------------------------------------------------------
# 4) Remove ^M from specified files
#-------------------------------------------------------------------------------
sed -i -e 's/\^M$//g' $@