Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1775 tbg config newline check #1777

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/tools/bin/tbg
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,29 @@ if [ ! -f "$cfg_file" ] ; then
fi

# cfg file sanity check - space after \ at EOL ?
cfg_err=`egrep "\\\\\[[:space:]]+$" $cfg_file | wc -l`
cfg_err=`egrep "\\\\\[[:blank:]]+$" $cfg_file | wc -l`
if [ $cfg_err != 0 ] ; then
echo "ERROR: file \"$cfg_file\" contains spaces after line continuation \\"
echo "Check the following lines for end-of-line spaces:"
echo ""
egrep -n "\\\[[:space:]]+$" $cfg_file
egrep -n "\\\[[:blank:]]+$" $cfg_file
echo ""
echo "Run the following command on the file to remove your"
echo "end-of-line (EOL) white spaces:"
echo ""
echo "sed -i 's/[[:blank:]]\+$//' $cfg_file"
exit 1;
fi

# cfg file sanity check - windows EOL? (CR LF)
cfg_err=`grep -c $'\r' $cfg_file`
if [ $cfg_err != 0 ] ; then
echo "ERROR: file \"$cfg_file\" contains" $cfg_err "non-unix new lines (\r)."
echo ""
echo "Run the following command on the file to convert all line endings"
echo "to pure unix line endings:"
echo ""
echo "dos2unix $cfg_file"
exit 1;
fi

Expand Down