Difference between revisions of "Oh"

From ArchWiki
Jump to: navigation, search
(Marked for deletion | This page should become a link to a section of [[List_of_Applications])
(Redirected page to Command Shell)
Line 1: Line 1:
[[Category:Command shells]]
#REDIRECT [[Command Shell]]
{{deletion|This page should become a link to a section of [[List_of_Applications]].}}
The oh shell ([https://aur.archlinux.org/packages.php?ID=58587 AUR]), formerly known as "gosh", is inspired by the Plan9 shell [http://cm.bell-labs.com/sys/doc/rc.html rc] and written in Google's new [http://golang.org/ Go] programming language, which also is inspired by Plan9 in some ways.
From the official [https://github.com/michaelmacinnis/oh/blob/master/README.md README]:
Oh is a Unix shell written in Go.  Like the rc shell, oh is similar in spirit
but different in detail from other Unix shells.
Oh extends the shell's programming language features without sacrificing the
shell's interactive features. The following commands behave as expected:
    cat /usr/share/dict/words
    who >user.names
    who >>user.names
    wc <file
    echo [a-f]*.c
    who | wc
    who; date
    cc *.c &
    mkdir junk && cd junk
    cd ..
    rm -r junk || echo "rm failed!"
Oh has objects but no classes. Objects can be created from scratch using the
'object' command. Private members are defined using the 'define' command and
public members are defined using the 'public' command:
    define point: object {
        define x: integer 0
        define y: integer 0
        public move: method a b {
            set $self::x: add $self::x a
            set $self::y: add $self::y b
        public show: method {
            echo $self::x $self::y
Objects can also be created by cloning an existing object:
    define o: point::clone
Modules are objects. The command below creates an object called 'm'. Public,
top-level definitions in 'file' can be accessed using the object 'm'.
    define m: import file
Channels are objects. Oh exposes channels, which are implicit in other shells
in the form of pipes, as first-class values. Channels can be created with the
'channel' command:
    define c: channel
Oh incorporates many features, including first-class functions, from the
Scheme dialect of Lisp. Like Lisp, oh uses the same syntax for code and data.
When data is sent across a channel it is converted to text so that it can be
sent to (or even through) external Unix programs.

Revision as of 18:37, 31 August 2013

Redirect to: