supprimer CR ligne terminateurs

Tout d'abord je voudrais dire que j'ai lu ce post cependant j'ai toujours des problèmes pour la CR line terminators.

Il y a un fichier appelé build_test.sh, j'ai édité en leafpad et il peut être affiché dans Vim:

cp ~/moonbox/llvm-2.9/lib/Transforms/MY_TOOL/$1 test.cpp 
cd ~/moonbox/llvm-obj/tools/TEST_TOOL/
make
make install
cd -

Cependant:

  1. À l'aide de cat build_test.sh il sorties rien.
  2. À l'aide de more build_test.sh il sorties:cd - install/llvm-obj/tools/TEST_TOOL/Y_TOOL/$1 test.cpp
  3. À l'aide de less build_test.sh il sorties: cp ~/moonbox/llvm-2.9/lib/Transforms/MY_TOOL/$1 test.cpp^Mcd ~/moonbox/llvm-obj/tools/TEST_TOOL/^Mmake^Mmake install^Mcd -

Le résultat de file build_test.sh est:

build_test.sh: ASCII text, with CR line terminators

Suivantes ce post, le ^M n'existe plus, cependant il n'y a plus de saut de ligne 🙁

Le résultat de file build_test_no_cr.sh est maintenant:

build_test_nocr.sh: ASCII text, with no line terminators

La solution peut être ici.

Cependant, je tiens encore pourquoi cat n'affiche rien et more affiche si étrange résultat. En outre pourquoi dos2unix et set fileformat=unix dans Vim échoue pour ce cas.

ps: je suppose que peut-être mon éditeur(Vim ou leafpad?) génère seulement \r plutôt \n pour le retour à la ligne. Comment peut-il en être ainsi?

InformationsquelleAutor Hongxu Chen | 2012-12-29