浏览代码

grass_indent.sh: Handle multiple files and filenames with spaces properly

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74017 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 6 年之前
父节点
当前提交
59ee805fe1
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      tools/grass_indent.sh

+ 4 - 2
tools/grass_indent.sh

@@ -26,8 +26,10 @@ else
 
  # fix broken gettext macros:
  grep -l '\<_$' "$@" | \
-     while read file ; do sed -i -e '/[( \t]_$/{;N;s/\n[ \t]*//;}' $file ; done
+  while read file ; do sed -i -e '/[( \t]_$/{;N;s/\n[ \t]*//;}' "$file" ; done
 
  # restore original file with timestamp if indent did not change anything
- cmp "$@"~ "$@" > /dev/null && mv -f "$@"~ "$@"
+ for file in "$@" ; do
+  cmp "$file"~ "$file" > /dev/null && mv -f "$file"~ "$file"
+ done
 fi