views:

2823

answers:

16

Bash is getting a little long-in-the-tooth. Windows has PowerShell (formerly known as Monad), which is capable of dealing with richer objects than just lines of text. Is there any equivalent new powerful shell for Linux/Mac?

It should be of similar expressiveness and functionality to Bash, but not afraid to tackle things in a different way.

A: 

ZSH is similar to bash, but more powerful in several ways.

Tom Ritter
+4  A: 

I have not tried this, but there is PASH, a PowerShell on Linux.

palehorse
+14  A: 

The fish shell is a more modern shell (syntax highlighting on the shell etc.)

(Install instruction for OS X)

Pieter
+4  A: 

Rush is pretty cool. It's very, very powerful. Haven't had much fun using it, though. It also is a bit of a departure in the syntax department.

Jim Puls
Voted up. Makes my cobbled together Ruby scripts look pedestrian :)
Justin Rudd
A: 

I don't know of anything that is directly similar to PowerShell for Linux/Mac. But you could use Ruby's interactive console to simulate a more full featured shell. Ruby has a module called FileUtils which would bring in things like "rm", "cp", etc. You'd then use Ruby as the actual language.

Not ideal when compared to PowerShell, but not unusable. I've used this idea (along with some custom ruby scripts) to debug running daemons (listing log files, looking at log files, talking to the daemon directly, etc.).

Justin Rudd
+1  A: 

For Mac, maybe Quicksilver? Not really a shell in the classic sense, but it allows you to do most file operations (copy, move, delete, rename, etc.) and many other actions (launch programs, run command line commands, etc.) from a nice UI with keyboard only. It has no programming though (no own kind of scripts).

It depends a lot what you really try to do. What for are you using the shell? Depending on the answer to this question, I might be able to suggest some alternatives.

E.g. if your main concern is that Bash shell scripts are too limited, use Perl. Perl is pretty much found on any Linux and it always has been part of Mac OS X (Apple uses it themselves in install packages for scripting), so for shell scripting, Perl is really a good replacement (much faster, much more powerful), but I don't think that is what you are looking for.

Mecki
+1  A: 

There's lush, a Lisp-based interactive shell.

Also, if you like a lispy-kind of shell but don't want the full-bore lispy-syntax shell like lush, then Emacs eshell might work for you: it preserves a conventional shell syntax, but you get most of the Emacs framework for free.

Ben Collins
A: 

I recently moved to ZSH and love it. I can't use a shell without a command line editor and this one is great if you know vi.

AdamC
ummm....lots of shells have a command-line editor. Even the VxWorks shell (which is only barely a shell at all) has that. What shell did you move from?
Ben Collins
Bash is emacs mode by default, try just changing it :)echo "set -o vi" >> ~/.bash_profile
slipsec
+16  A: 

As AviewAnew noted, zsh is a nice alternative (it's an expansion on ksh). A few highlights from around the web:

  1. Typo correction (Did you mean _?)
  2. Syntax lookup (move your cursor to the command, Alt-H opens man page)
  3. Auto-complete remove files (in addition to files and parameters)
  4. History command completion (don't press up, just begin the command and press Alt-P)
  5. Command line replace (mis-spelled command 'get' with 'gey' and hit enter? just type ^gey^get to replace)
  6. Built in paging (quick and easy, don't rely on less, cat)

Check out the zsh guide for more.

(source 1, source 2)

Devin Reams
bash has #4 via history-search-backward and also has #5.
Dennis Williamson
I also like zmv autoload, which allows to rename group of files, e.g: "zmv '(*).MP3' '$1.mp3'
A: 

I'm a fan of tcsh, especially when combined with the Matt's Utterly Insane .tcshrc.

Joe Skora
+1  A: 

I agree with one of the posters above; zsh is extremely powerful. The Guide is especially helpful. I basically went through it for a couple days and added all of the features that I liked (for example, history that persists in multiple sessions) to my .zshrc. If you are interested I could get you my .zshrc.

Frew
+6  A: 

As Palehorse says, Pash is something you may want to check out. Allow me to go into more detial.

Pash is a work-in-progress "open source re-implementation of PowerShell" on top of Mono. Not only does it run on Linux but it can run on Mac or even Windows Mobile (which I was pretty impressed with).

Now I'm hella-biased, but let me do some bullet-point PowerShell features real quick:

  • It's object-oriented
  • The syntax is awesomely consistent and easy-to-learn and retain.
  • You have access to .NET (and in pash's case, Mono).
  • Community support: tons of resources at http://powershellcommunity.org and nntp:microsoft.windows.server.powershell
  • Have a cross-platform shop? Imagine how much easier it will be to communicate with your (lesser?) Windows brethren. :)

For additional resources, we discussed Pash on the PowerScripting Podcast episode 27 if like that format. Also, one of the devs likes to hang out on #powershell on FreeNode; he goes by "emet".

halr9000
A: 

I strongly recommend Fish, its excellent. Much more user-friendly, I really miss it when working without it. It has far more powerful tab completion, and color coding (valid commands are green, folders are blue, etc) Very handy.

Jarek
+3  A: 

This answer is about shells that deal with more than just text in pipes - fish and zsh have improvements over bash, but ultimately just deal with text, unlike MS Powershell which uses objects in its pipes.

Hotwire

Hotwire has an object pipeline that works in a similar way to Microsoft Powershell, allowing commands in the pipe to access object properties directly rather than having to do text processing to extract it.

It also attempts to combine the power of the traditional command line interface with GUI elements. You can use all your common system commands, but a number of key ones have new versions by default which use an object pipeline, and are displayed with a nice GUI view. In particular ls (aka dir) shows lists files and shows them in columns. You can sort by clicking on the column headers, double click on files to open, or double click on directories to move to that directory. The proc command allows you to right click on a process and one of the options is to kill it.

Hotwire is cross platform (Linux, BSD, Windows, Mac), though it is at an early stage of development. To learn more, install (click on the link for your platform) and work through the simple getting started page.

Pash

pash (as mentioned by others) is an open source port of MS Powershell.

IPython

IPython is another object oriented pipeline based shell. I haven't used it, but there are interesting examples using IPipe.

Others

You could also look at the list of related projects and ideas maintained on the hotwire wiki.

Note Hotwire is the only one of the above I've used.

Hamish Downer
A: 

Off the top of my head, there is rc, the Plan 9 from Bell Labs shell, and there is scsh, which runs a scheme interpreter as your shell.

dsm
A: 

They will have to pry ksh from my cold dead hands.

When I first learned UNIX in college, csh was pretty much the standard where I was at. Bash came along with some revolutionary features and so I switched to that while I learned Linux.

Now that I'm no longer a UNIX newb, I prefer OpenBSD to Linux... needless to say it comes with ksh as the default for a reason. It was a bit of an adjustment at first, but now I much prefer it to anything else - including bash.

ceretullis
Oh, my, the Right of the People to Keep and Bear Arms; and to shoot themselves in the foot... (:-)
Brent.Longborough