Skip to content

Commit 5532805

Browse files
Specifies the file type for the find command (#37)
1 parent ce5f120 commit 5532805

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

SCRIPTS/03_convert_translation.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,44 @@
55
# Convert translation files zh-cn to zh_Hans
66
# The script is still in testing, welcome to report bugs.
77

8-
po_file="$({ find |grep -E "[a-z0-9]+\.zh\-cn.+po"; } 2>"/dev/null")"
8+
po_file="$({ find -type f |grep -E "[a-z0-9]+\.zh\-cn.+po"; } 2>"/dev/null")"
99
for a in ${po_file}
1010
do
1111
[ -n "$(grep "Language: zh_CN" "$a")" ] && sed -i "s/Language: zh_CN/Language: zh_Hans/g" "$a"
1212
po_new_file="$(echo -e "$a"|sed "s/zh-cn/zh_Hans/g")"
1313
mv "$a" "${po_new_file}" 2>"/dev/null"
1414
done
1515

16-
po_file2="$({ find |grep "/zh-cn/" |grep "\.po"; } 2>"/dev/null")"
16+
po_file2="$({ find -type f |grep "/zh-cn/" |grep "\.po"; } 2>"/dev/null")"
1717
for b in ${po_file2}
1818
do
1919
[ -n "$(grep "Language: zh_CN" "$b")" ] && sed -i "s/Language: zh_CN/Language: zh_Hans/g" "$b"
2020
po_new_file2="$(echo -e "$b"|sed "s/zh-cn/zh_Hans/g")"
2121
mv "$b" "${po_new_file2}" 2>"/dev/null"
2222
done
2323

24-
lmo_file="$({ find |grep -E "[a-z0-9]+\.zh_Hans.+lmo"; } 2>"/dev/null")"
24+
lmo_file="$({ find -type f |grep -E "[a-z0-9]+\.zh_Hans.+lmo"; } 2>"/dev/null")"
2525
for c in ${lmo_file}
2626
do
2727
lmo_new_file="$(echo -e "$c"|sed "s/zh_Hans/zh-cn/g")"
2828
mv "$c" "${lmo_new_file}" 2>"/dev/null"
2929
done
3030

31-
lmo_file2="$({ find |grep "/zh_Hans/" |grep "\.lmo"; } 2>"/dev/null")"
31+
lmo_file2="$({ find -type f |grep "/zh_Hans/" |grep "\.lmo"; } 2>"/dev/null")"
3232
for d in ${lmo_file2}
3333
do
3434
lmo_new_file2="$(echo -e "$d"|sed "s/zh_Hans/zh-cn/g")"
3535
mv "$d" "${lmo_new_file2}" 2>"/dev/null"
3636
done
3737

38-
po_dir="$({ find |grep "/zh-cn" |sed "/\.po/d" |sed "/\.lmo/d"; } 2>"/dev/null")"
38+
po_dir="$({ find -type d |grep "/zh-cn" |sed "/\.po/d" |sed "/\.lmo/d"; } 2>"/dev/null")"
3939
for e in ${po_dir}
4040
do
4141
po_new_dir="$(echo -e "$e"|sed "s/zh-cn/zh_Hans/g")"
4242
mv "$e" "${po_new_dir}" 2>"/dev/null"
4343
done
4444

45-
makefile_file="$({ find|grep Makefile |sed "/Makefile./d"; } 2>"/dev/null")"
45+
makefile_file="$({ find -type f |grep Makefile |sed "/Makefile./d"; } 2>"/dev/null")"
4646
for f in ${makefile_file}
4747
do
4848
[ -n "$(grep "zh-cn" "$f")" ] && sed -i "s/zh-cn/zh_Hans/g" "$f"

0 commit comments

Comments
 (0)