[Samba] readable tiny odd script question

BISI d3r3kshaw at gmail.com
Sat Jan 10 08:24:25 MST 2015


On 15-01-10 06:43 AM, Bob of Donelson Trophy wrote:
>
>
> I have been reviewing Louis' script
> (4-setup-sernet-samba4-MEMBER-wheezy.sh) and within the following line
> (310) is an odd character combination.
>
> if [ ${SMBPRINTING} = no ]; then
> echo "==========Disable Printing ==============================="
> sed -i '49a\n # disable printing completelyn load printers = non
> printing = bsdn printcap name = /dev/nulln disable spoolss = yesn'^M
> <<<<<<< WHAT?
>   /etc/samba/smb.conf
> fi
>
> I am using vi editor (Debian 7.7.0) and noticed "^M" at the end of the
> line. This character combination appears twice within the script. Both
> time as a unique font color. Here listed above and finally on the last
> line of the script. In 'test' removing the character combination the
> cursor responds as though this is a single character. In other words, a
> single keystroke removes both characters.
>
> Is this a necessary character for the script to function properly? Or is
> it rogue and causing some unforeseen issues?
>
> (I feel bad raising this question while Louis is on a holiday. Many of
> us have been using his script for some time now and history indicates
> that they are working scripts. And I for one really appreciate all the
> work that went into them.)
>
IIRC the ^M (as a single character) is an artefact of windows CR/LF 
(newline) as represented in vi.

you can get rid of it with dos2unix (apt-get install dos2unix) using 
something like
dos2unix < newFileName > 4-setup-sernet-samba4-MEMBER-wheezy.sh

the vi I am using (vim.basic, added after install) does not show the ^M 
construct on files that I know have it (probably a setting somewhere)

I believe ctrl+m will reproduce the "single character".  In my instance 
of vi, it creates a newline without showing the ^M that I definitely 
remember seeing in my users (windows) logon scripts.

Cheers!
d.



More information about the samba mailing list