One of the differences between a Windows (DOS) file and a Linux file is how the newlines are stored.
Windows uses two characters (a carriage-return and a line-feed, typed as Ctrl-M, which means to hold the control
key and the m key at the same time) while Linux uses 1 character (a newline, typed as the enter key).
One way to tell which you have is to use the file command. Can you tell which is which based on output like this?
$ file r1 r2
r1: ASCII text, with CRLF line terminators
r2: ASCII text
How much bigger would r1 be than r2? (Use wc to check).
Your assignment:
Copy/paste the code below into the makedos script:
#!/bin/bash
makedos()
{
sed -i -e 's/$/^M/' $1
}
for f in $*
do
file $f
makedos $f
file $f
done
Change the ^M to actually be a Ctrl-M using these steps:
put your cursor on the ^
type 2s (this will let you substitue the next 2 characters)