0

I am using Korn Shell on an iMac, and I attempt to add this alias:

alias xyzzy=‘print Nothing happens.’

If I add it as above in my console, it works just fine. But, if I then put it into my .profile file, and restart console, it does not. I get this:

xyzzy=print
pwaugh$ 

In other words, it is only adding the first word to the alias! I have looked at my KSH book and do not see anything wrong in what I am attempting. Any ideas??

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
patrick
  • 1
  • 1
  • 2
    Did you copy and paste that alias command into your question? Because there's no way it would work with those fancy non-ASCII quotes. You need to use plain old `'` (U+0027 APOSTROPHE) at the beginning and end. On US English QWERTY keyboards, it's on the key immediately to the left of the return key. – rob mayoff Jan 25 '14 at 04:34
  • That is the ' key. Just the font looks weird in the code tag. – patrick Jan 26 '14 at 08:34
  • Your suspicious was, however, correct. When I copy and pasted from the console version, to the .profile file, it works fine. Somehow the one app interprets the key press into some other ascii character. Thanks for your help. :) – patrick Jan 26 '14 at 08:38
  • For others on an iMac, one must press CTRL-' to get the correct ASCII character '(U+0027 APOSTROPHE), when in the TextEdit editor app. Just pressing the key gives you something else entirely when in TextEdit. – patrick Jan 26 '14 at 08:40
  • Don't use TextEdit to edit code. Use a real programmer's editor. http://stackoverflow.com/questions/20533/mac-text-code-editor – rob mayoff Jan 26 '14 at 15:44

1 Answers1

1

The problems is the “smart” quotes. Korn shell doesn't understand them. You need to use plain old “single” quotes (apostrophes).

You can prevent TextEdit from substituting smart quotes by going to the menu bar and unchecking Edit > Substitutions > Smart Quotes.

However, you will be better off using a programmer's editor instead of TextEdit. There are many to choose from. See this question.

Community
  • 1
  • 1
rob mayoff
  • 375,296
  • 67
  • 796
  • 848