Korn Shell Comes to OS X!

Discussion in 'macOS' started by Cooknn, Apr 14, 2005.

  1. Cooknn macrumors 68020

    Cooknn

    Joined:
    Aug 23, 2003
    Location:
    Fort Myers, FL
    #1
    Anybody else excited to hear about the Korn Shell's debut in Mac OS X Tiger? I cut my teeth with UNIX on an IBM RS/6000 running AIX. Did time in Atlanta and Tampa at IBM's training facilities, etc. All I've ever known is the Korn shell, until I switched to Mac OS X in November of 2003.

    Can we read anything into this addition into OS X? Could Apple be doing this to satisfy IBM? I can't help but wonder if IBM didn't get out of the x86 business so that they could focus on a new division built around the PPC. The IBM Mac :eek: Could they even do that and stay within the terms of their agreement with Lenovo?
     
  2. kg9ov macrumors member

    Joined:
    Feb 12, 2005
    Location:
    In front of a computer...
    #2
    I agree, ksh is certainly a welcome addition to the list of shells included in Tiger. Personally, I don't think that there is any hidden message to be seen here though. ksh is one of the more popular shells on a wide variety of UNIX-based systems.

    I am also very happy to see the enhancements to other CLI utilities (cp, mv, tar, rsync, etc.) to properly handle resource forks.

    -Tony
     
  3. grapes911 Moderator emeritus

    grapes911

    Joined:
    Jul 28, 2003
    Location:
    Citizens Bank Park
    #3
    I really hated ksh on linux. It just seems very 'odd' to me. I do like the fact that they are putting it in tiger though. It makes os x more unix-like to have more shell options. I hope isn't not the default, and I hope they didn't get rid of bash.
     
  4. jim. macrumors 6502

    Joined:
    Dec 22, 2004
    Location:
    C-ville, VA
    #4
    Depends on the ksh they use. I'm getting lazy now, and love my tab completion. I know I can keybind tab to cmd completion in the rc file, but again... laziness. Think it is ksh93 going in?

    Jim
     
  5. Logik macrumors 6502a

    Joined:
    Apr 24, 2004
    #5
    personally I prefer zsh... which i believe is already included in OS X.. however if it wasn't then i musta added it myself :p
     
  6. kg9ov macrumors member

    Joined:
    Feb 12, 2005
    Location:
    In front of a computer...
    #6
    According to this page, bash is still there and is still the default.

    http://www.apple.com/macosx/features/unix/

    From the sidebar at the link above:
    "Korn Shell - Run scripts written for Sun Solaris more easily via AT&T’s ksh."

    My guess would be it is AT&T's ksh93. It has been publicly available for a few years now.

    http://www.kornshell.com/

    -Tony
     
  7. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #7
    Bash and (somewhat later) tcsh have had tab completion for a long time - are you saying Korn doesn't?

    That would be very surprising. In most every way OS X has been moving closer to other *nixes, rather than going its own way - and bash is the default shell on most of them anymore.
     
  8. Cooknn thread starter macrumors 68020

    Cooknn

    Joined:
    Aug 23, 2003
    Location:
    Fort Myers, FL
    #8
    From the KSH-93 FAQ
     
  9. plinden macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #9
    bash pwnz ksh

    Not that I know a lot about ksh - I'm just used to bash and wouldn't want to change.
     
  10. kg9ov macrumors member

    Joined:
    Feb 12, 2005
    Location:
    In front of a computer...
    #10
    Other than the various Linux distros and Mac OS, do you know of another *nix system that uses bash as the default shell? I am just curious if others have moved to bash. I have not heard of any, but that doesn't mean it didn't happen.

    -Tony
     
  11. mattraehl macrumors 6502

    Joined:
    Feb 26, 2005
    #11
    A welcome addition, indeed!

    That is good news! However, I imagine that most folks that really wanted Korn shell already compilied it (Or, for that matter, downloaded the ppc binary from AT&T's website) and has it running on their Mac. It's been free for a few years now. At work almost all of our machines are HP-UX (Hewlett-Packard Unix), which uses ksh. I couldn't stand having a different shell at home, so I installed in on my iBook. Long live ESC-ESC (or ESC-\) filename completion! :)
     
  12. Cooknn thread starter macrumors 68020

    Cooknn

    Joined:
    Aug 23, 2003
    Location:
    Fort Myers, FL
    #12
    I guess I haven't been that ambitious (to get ksh on my Mac). I've really been away from AIX for a while, but when I was working with it I was always on an IBM3151. I have to say that I do like the DIR_COLORS in bash on my Mac. Should that work with ksh as well?
     
  13. kg9ov macrumors member

    Joined:
    Feb 12, 2005
    Location:
    In front of a computer...
    #13
    Are you talking about different colors for files, links, etc. in a directory listing? Someone correct me if I'm wrong (I don't use the color stuff), but isn't this handled by the ls command rather than the shell?

    -Tony
     
  14. Cooknn thread starter macrumors 68020

    Cooknn

    Joined:
    Aug 23, 2003
    Location:
    Fort Myers, FL
    #14
    DIR_COLORS lives in /etc and it kicks off in my .bashrc so I assume it's handled by the shell.
     
  15. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #15
    Well, actually, now that I've done some digging... :D

    Here at UW the default shell on all sorts of OSes (Linux, AIX, Solaris) has been set to bash - so I assumed that was the default. However for Solaris it appears the install default is bsh (Bourne), not bash (Bourne Again). And as others point out for AIX it's ksh as of 4.1 (and bsh prior to that).

    I thought the BSDs were all doing bash now, but my BSD-loving coworker is out of the office right now so I can't check that.

    Edit: Nope. Depending on the flavor of BSD it's either bsh, csh, or ksh. Figures. :D
     
  16. kg9ov macrumors member

    Joined:
    Feb 12, 2005
    Location:
    In front of a computer...
    #16
    OK, I didn't have time to go researching it earlier. I know HP-UX does not have bash by default and I thought most of the other major Unix OSs were also still using sh, ksh, or csh.
     
  17. jim. macrumors 6502

    Joined:
    Dec 22, 2004
    Location:
    C-ville, VA
    #17
    I've always seen old korn shells on Solaris machines. When I was in college, the Sun machines ran ksh88 (which btw does NOT have tab completion), and I just set it to run bash on login. Here at UVA, it also runs ksh88 apparently. No tab completion. Hence my comment above.

    For my chem work, we used IRIX machines, and those were set to tcsh, but I believe that was a custom shell setting. Then I found bash, and loved the simplicity of its scripting so it kind of stuck with me. Now I'm just spoiled and lazy.

    Jim
     
  18. kg9ov macrumors member

    Joined:
    Feb 12, 2005
    Location:
    In front of a computer...
    #18
    Well, it could be worse. You could have been stuck with the Bourne shell that comes with Solaris. :eek:

    -Tony
     
  19. anonymous161 macrumors 6502

    Joined:
    Apr 15, 2003
    Location:
    Where the wind comes sweeping down the plains
    #19

    what do I have to do to set up DIR_COLORS? I guess I didn't know about it but it sounds useful. I use bash on 10.3.
     
  20. mattraehl macrumors 6502

    Joined:
    Feb 26, 2005
    #20
    For BSD-based UNIX systems, ls -G gives you colors, and the color settings come from an environment variable, it's either LSCOLORS or LS_COLORS, I'm not at my machine so I can't verify. The ls man pages give the name of the variable, and how to configure it. So I just do alias ls='ls -G' and define LSCOLORS in my .profile.
     
  21. Cooknn thread starter macrumors 68020

    Cooknn

    Joined:
    Aug 23, 2003
    Location:
    Fort Myers, FL
    #21
    Thanks Matt :)
    Turns out I'm not using DIR_COLORS at all :eek: I must have been experimenting with it before I figured out that all I needed to do was add alias ls='ls -G' to my /etc/bashrc
    Can't remember though, where I defined the non-standard color attributes :confused:
     
  22. mattraehl macrumors 6502

    Joined:
    Feb 26, 2005
    #22
    custom ls colors

    This is from the ls man pages:

    LSCOLORS The value of this variable describes what color to use
    for which attribute when colors are enabled with
    CLICOLOR. This string is a concatenation of pairs of the
    format fb, where f is the foreground color and b is the
    background color.

    The color designators are as follows:

    a black
    b red
    c green
    d brown
    e blue
    f magenta
    g cyan
    h light grey
    A bold black, usually shows up as dark grey
    B bold red
    C bold green
    D bold brown, usually shows up as yellow
    E bold blue
    F bold magenta
    G bold cyan
    H bold light grey; looks like bright white
    x default foreground or background

    Note that the above are standard ANSI colors. The actual
    display may differ depending on the color capabilities of
    the terminal in use.

    The order of the attributes are as follows:

    1. directory
    2. symbolic link
    3. socket
    4. pipe
    5. executable
    6. block special
    7. character special
    8. executable with setuid bit set
    9. executable with setgid bit set
    10. directory writable to others, with sticky bit
    11. directory writable to others, without sticky
    bit

    The default is "exfxcxdxbxegedabagacad", i.e. blue fore-
    ground and default background for regular directories,
    black foreground and red background for setuid executa-
    bles, etc.


    Upon digging deeper, I found out that the alternative to defining the alias ls='ls -G' is setting the environment variable CLICOLOR=1. If CLICOLOR=1, ls will give colors, whether you give ls -G or just ls.
    :D
     
  23. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #23
    I'm still using tcsh, is there something I'm missing by not switching to bash or ksh? I'm not doing anything fancy, just some basic CL stuff.
     
  24. mattraehl macrumors 6502

    Joined:
    Feb 26, 2005
    #24
    not really

    Unless you're writing actual shell scripts, not just entering comands at the prompt, there really aren't huge differences between any of the major shells. In fact, if you are just doing basic shell scripts, you won't even notice much difference between bash and ksh, since they are both something like 99% bourne shell (sh) backwards-compatible. But, C-style shell languages (tcsh, csh) are very different when it comes to scripting. Their scripting language is more like C, which was supposed to be a good thing, but in my opioning it just ends up kind of messy. But some people love their C shells.
     
  25. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #25
    Yeah, when I write scripts, I just use the !sh anyway. I'm just wondering if I should switch to bash, since it's the standard shell now. Maybe easier to get help with and run sample commands on? Does it have tab-completion of directory fragments like tcsh does though? That's probably the one feature I couldn't live without.
     

Share This Page