Fix missing .Mathematica dir from home install
[khome.git] / home / bin / dotnet-new-cleanup
CommitLineData
c35dfd6a
SK
1#! /bin/sh
2
3BOM='^\xef\xbb\xbf'
4
5case "`uname`" in
6 Darwin)
7 _sed=gsed;
8 _grep=ggrep;;
9 *)
10 _sed=sed;
11 _grep=grep;;
12esac
13
14case "$1" in
15 '') _dir=.;;
16 *) _dir="$1";;
17esac
18
19_find() {
20 _pattern="$1"
21 LC_ALL=C "$_grep" \
22 --color=never \
23 -rIcP \
24 --exclude-dir=.git \
25 "$_pattern" "$_dir" \
26 | awk -F: '$2 {print $1}'
27}
28
29_delete() {
30 _pattern="$1"
31 while read _file
32 do
33 tmp="`mktemp`"
34 LC_ALL=C "$_sed" "s/$_pattern//" "$_file" > "$tmp"
35 mv "$tmp" "$_file"
36 done
37}
38
39
40echo 'BOM:'
41echo '----'
42_find "$BOM"
43_find "$BOM" | _delete "$BOM"
44
45echo ''
46
47echo 'Trailing carriage return:'
48echo '-------------------------'
49_find '\r'
50_find '\r' | _delete '\r'
This page took 0.033703 seconds and 4 git commands to generate.