2

Recently, I have written one shell script in Notepad++ on Windows machine. But when I transferred this script to Linux box I observed that the commands containing - (dash or hyphen or minus) sign got replaced with <96>. e.g. the original command is like below -

unzip -d $dir_to_unzip file.zip

But when transferred to Linux server it became like below-

unzip <96>d $dir_to_unzip file.zip

I am not an Unix expert and not able to find what is causing this change and how to correct it. Any help would be really appreciated.

iNikhil19
  • 97
  • 3
  • 11
  • 3
    `0x96` is the code for the `–` EN DASH character in the Windows-1252 character set. The original command does not have the hyphen character you want; it has a representation of the EN DASH character. The two characters look very similar on Windows, but Linux doesn't use the Windows-1252 character set, so `0x96` is some non-printable control character, which is being rendered as `<96>`. (The Unicode code for EN DASH is `0x2013`.) – Keith Thompson May 19 '15 at 21:19

2 Answers2

1

Notepad++ has a set of menus for specifying the encoding. A quick check with its default (UTF-8 without BOM) does not give me a non-ASCII text for a simple shell script. It is possible that you got this example by pasting text into Notepad++ from some webpage (which frequently are misencoded).

However, to ensure that you get the results which you expect, you can override the encoding using Notepad++ menus, and re-save the file. Besides UTF-8, other possibly useful choices include (via the cascading menu for "Western European"...) ISO-8859-1.

You should avoid using "ANSI" in Notepad++, because it is an ambiguous term which includes the sort of character redefinition which is causing you problems. For further discussion on this, see

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
0

You'll either have to figure out how to type a real (ASCII) minus sign in Notepad, or you'll have to avoid using your Windows machine to edit ASCII text files intended for use on linux or unix hosts.

Greg A. Woods
  • 2,663
  • 29
  • 26