2

I'm looking for a modern shell for Ubuntu.

Here is the first qualifying issue, say in a build style script (not looking for a build system btw):

In powershell:

new-item workspaces\crm\builds\demo -ItemType Directory

Now, the clever bit, if none of the preceding directories exist, it's clever enough to just to create them all, if on a subsequent run only demo dir is missing it creates that. In Bash I need to do a loop construct or manually cd dirname, mkdir subdirname, cd subdirname Nah... I want less friction.

I want convention over configuration. Some might deem the above command to do be doing too much, but with flags I can move away from the convention. If that make sense, the shortest command should do the most logical thing, side cases expressed with explicit options.

Suggestions?

4
  • 3
    the main difference between something like that in powershell and doing that in a *nix shell is that powershell defined all the functions for you. all that is doing is calling .net code that's probably running the same type of loops you're describing. maybe you should be looking for script libraries instead of a different shell? Oct 12, 2010 at 4:34
  • I appreciate that. But the fact that Powershell provides it out the box means less friction, I coudlnt care if its in the BCL or PS environment as cmdlets. Its just there. Oct 12, 2010 at 4:41
  • 3
    It sounds like bash can do all you need and more. given that mkdir -p solves your original issue, is there any other issues you're struggling with ? I'm willing to bet this is a case of not knowing the tools rather than the tools not being up to the job.
    – Sirex
    Oct 12, 2010 at 17:05
  • after a lot of fiddling with powershell, i think this question is a good one, but not in it's current form. Really it seems that mattcodes was having problems with some specific tasks. If this question had some more specific reasons why a powershell-like shell for *nix would be desirable, I would love to know if anything is in the works. Specifically, the main reason I like powershell is that it is object rather than text-based, which greatly simplifies a lot of administrative tasks. Dec 2, 2010 at 21:03

2 Answers 2

16

Use bash, and set up some aliases that fit your need, e.g.

alias md='mkdir -p'

Some examples:

alias ..='cd ..'
alias ...='cd ../..'
alias grep='grep --colour=auto'
alias l='ls -lh'
alias ll='ls -lah'
alias ls='ls --color=auto'

UPDATE: you might also want to check out oh-my-zsh.

After more than a year, I feel like it is necessary to update this answer. I found that oh-my-zsh is one of the most powerful, flexible and well maintained tools for the terminal. (Although in fact it is just a collection of plugins and different settings, it is very powerful.)

5

I'm not familiar with powershell, but it looks to me like you just want to do something like:

mkdir -p /new_dir/subdir1/subdir2/subdir3

That'll create subdir3 and any of the intervening directories necessary.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .