In shell-programming you often want to continue a programm, when
the user clicks any button. Normaly "read" is used if you would like
to continue with any key then use this:
stty raw; dd if=$(tty) of=/dev/null bs=1 count=1; stty -raw
if you have transferred a file from MS Windows to UNIX, you might
find that the file looks like this:
bleh bleh ^M
leh leh ^M
tey tey tey^M
This is because Windows uses carridge
return and newline to indicate a new line.
Here are a number of
ways to get rid of the ^M characters:
1- cat filename1 | tr -d
"^V^M" > newfile
2- sed -e "s/^V^M//" filename >
outputfilename
where ^V is actually control-V and ^M is actually
control-M (you must type these yourself, don't just copy and paste
this command from this web page)
3-vi solution : open file with
vi
1. hit the ESC key
2.
:%s/^V^M//
3 - some distributions contain a command called
dos2unix which removes these carridge return characters
4-
use the texteditor vim (www.vim.org) and edit the file. If all the
lines (not only some) contain consistently the carridge return
characters then vim will show [textmode] and when you change the
mode with the command
:set notextmode
it will remove them.