Live data from Hacker News

Xonsh, a Python-ish, Bash-compatible shell language and command prompt

xonsh.org

51–60 of 63 posts

Re: Xonsh, a Python-ish, Bash-compatible shell language and command prompt

#53
Interesting thread. For some alternative ways of doing "pipe-like" stuff in Python (with more than one meaning of the term), see these links:

Swapping pipe components at runtime with pipe_controller:

http://jugad2.blogspot.in/2012/10/swapping-pipe-components-a...

That above post was the last in a series that I wrote over a period. The series describes both a) a small experimental tool I wrote, with examples of a few ways of using it, and b) some other Python-shell tool alternatives that I came across. pipe_controller was inspired by reading about and trying out some of those other tools.

The post above links recursively to all the other posts in the series, but for convenience, I'm pasting selected other links below:

Using PipeController to run a pipe incrementally:

http://jugad2.blogspot.in/2012/09/using-pipecontroller-to-ru...

Some ways of doing UNIX-style pipes in Python:

http://jugad2.blogspot.in/2011/09/some-ways-of-doing-unix-st...

Plumbum, UNIX shell-like library and tool in Python:

http://jugad2.blogspot.in/2012/08/plumbum-unix-shell-like-li...

Re: Xonsh, a Python-ish, Bash-compatible shell language and command prompt

#54

Is there a ruby-ish shell out there?

There was one called rush, by Adam Wiggins, co-founder of Heroku, IIRC. I had tried it out a bit after it first came out. Just now did a Google search for "ruby shell rush" - without the quotes, and it found it - first result, though the others about it look interesting too. Not sure if the project is active though.

Re: Xonsh, a Python-ish, Bash-compatible shell language and command prompt

#55

I'm a lead dev on the fish shell ( http://fishshell.com ) xonsh looks very cool. Shell scripting languages are famously obtuse and underpowered, and we've thought about how to cleanly merge shell scripting with a real language. It's heartening to see an attempt at it. Ambiguous syntax is a sticking point. For example, say the user runs this: [ 1 ] is this constructing a Python list with the value 1, or is it invoking…

Thanks for posting this @ridiculous_fish! I am the main author of xonsh, and I really appreciate fish. Its awesome and I am certainly going to borrow ideas :). I agree that making shell languages into 'real' languages is strong goal that we should all have. And like with real languages, many can co-exist happily. I'd like to point out though, that the goal is not to have bash-compatibility. As you point out, bash doe…

FYI, I interpreted "BASH-wards compatible" as "BASH-compatible" as well. The subtlety seems a little lost on me.

Re: Xonsh, a Python-ish, Bash-compatible shell language and command prompt

#56

I'm a lead dev on the fish shell ( http://fishshell.com ) xonsh looks very cool. Shell scripting languages are famously obtuse and underpowered, and we've thought about how to cleanly merge shell scripting with a real language. It's heartening to see an attempt at it. Ambiguous syntax is a sticking point. For example, say the user runs this: [ 1 ] is this constructing a Python list with the value 1, or is it invoking…

Thanks for posting this @ridiculous_fish! I am the main author of xonsh, and I really appreciate fish. Its awesome and I am certainly going to borrow ideas :). I agree that making shell languages into 'real' languages is strong goal that we should all have. And like with real languages, many can co-exist happily. I'd like to point out though, that the goal is not to have bash-compatibility. As you point out, bash doe…

"BASHwards" is a bad word to use for this, since the natural interpretation is that it is a combination of "backwards" and "BASH" meaning thatn xonsh is an "upgrade" that is backwards-compatible with BASH.

It seems to be more intended to be not backward-compatible, but to have some attention to minimizing the pain of transition, which is valuable, but needs different language to communicate.

Re: Xonsh, a Python-ish, Bash-compatible shell language and command prompt

#57
post #52

Is && and || supposed to supported? When I try "command && someothercommand", which is a common bash idiom, xonsh seems to just freeze up until a ctrl+c. It also jumps up to around 100% CPU.

Additionally, redirection of stderr with 2> doesn't seem to work. Can you describe (or point out in the docs) how to accomplish this? Thank you.

Re: Xonsh, a Python-ish, Bash-compatible shell language and command prompt

#58

I genuinely wish there was an alternative that could gain enough traction to reach critical mass and hopefully start shipping with operating systems. I've never bothered to learn bash because it was always so damned confusing, and I just couldn't get over the idiosyncrasies when playing around with it. I wouldn't mind putting in time to learn something new and actually user-friendly.

.. you say a shell command line should be user friendly? What kind of user would use command line? We are all bofhs here. Also some of us are being paid to write bash scripts. I'm for example forced into bash because of AIX server. Learing bash is fun and profitable...

> I'm for example forced into bash because of AIX server.

What? Consider yourself lucky. All of my AIX was ksh. If I wanted to be especially rebellious, I would use ksh93.

Re: Xonsh, a Python-ish, Bash-compatible shell language and command prompt

#59
post #47

Earlier quoted context omitted.

Is there a reason xonsh doesn't honor the PS1 variable from bash to keep your terminal prefix? Or is there a way to customize xonsh's? Example: 10:54:01 foo@bar:~/scripts/xonsh$ xonsh foo@bar ~/scripts/xonsh $ # no time prefix

If you go to [ http://xonsh.org/tutorial.html#environment-variables ] and scroll down to the table, you can see how to change the prompt :)

Thanks, doesn't look like you can use anything that isn't in the supported keywords though (like date/time)

Re: Xonsh, a Python-ish, Bash-compatible shell language and command prompt

#60
post #59

Earlier quoted context omitted.

If you go to [ http://xonsh.org/tutorial.html#environment-variables ] and scroll down to the table, you can see how to change the prompt :)

Thanks, doesn't look like you can use anything that isn't in the supported keywords though (like date/time)

It looks to me like you can.

> PROMPT: The prompt text, may be str or function which returns a str.

If you need non-built-in values in your prompt, just set PROMPT to a function, and call something like `date` within the function. Use `%` to format `date`’s output into a template string, and then pass that template string to `xonsh.environ.format_prompt` to get the final value to return from the function.

Post reply on HN