【发布时间】:2008-09-02 01:01:56
【问题描述】:
我想对正在提交的文本文件运行以下脚本:
# Send the commands H and w to ed
# ed will append newline if the file does not end in one
printf "%s\n" H w | ed -s $1
# Strip trailing whitespace
sed -i 's/[ \t]*$//g' $1
# Convert tabs to 4 spaces
sed -i -r "s/\t/ /g" $1
我看到 subversion 有一个 start-commit 和 pre-commit 钩子,但我无法按照文档了解如何使用上述脚本处理文本文件。
【问题讨论】: