Hacker News new | past | comments | ask | show | jobs | submit login
Rsh: Ruby SHell (github.com/isene)
74 points by mpweiher on June 4, 2023 | hide | past | favorite | 37 comments



"Aliases (called nicks in rsh)"

Just, why? Everything else calls them aliases. Everyone knows what an alias is.

Is this something that works differently and so needs a different name?

If 'alias' was a badly chosen 'standard', then there's a case to try to change it, but 'alias' seems to be quite precise and fitting to me.


Probably because “alias” is a keyword in Ruby.


Sure, and it means exactly what you expect it to mean in ruby (though tinged with 'bad idea', in the case of aliasing variable names), so that's even more reason to use it (find a way to mesh with irb or whatever they're using as 'backend'). It's 'ruby shell' after all.


(slight ot, sorry!) This brings back great memories of one of the best assignment from my college time: We had an "Agile web development" course (~2007) with a precursory Ruby 101 workshop as well as a pre-course assignment to "create a shell in Ruby". It was such a joy to hack on this and learn that way. It was clearly wayyy too vast of a task to ever _complete_ it, but I learned so much Ruby there and couldn't stop working on the project. Thanks Carsten Bormann for being a great teacher!

And thanks op for reminding me of this :)


Sat in that same course. Nice to see Bremen people here


:D Great! What are you up to nowadays?


Not great naming imho, this has been around for 40 years.. https://en.wikipedia.org/wiki/Remote_Shell


Could have named it rbsh. Though the pronunciation could be controversial.


rubbish!


Seconded. Naming an interactive language shell after ssh's older, insecure cousin just seems like begging for trouble.

I'm imagining some auditor seeing an "rsh" binary on a Linux system and dinging the system on it, and weeks of back and forth emails and meetings required to determine that, no, in fact, this is not remote shell, it's Ruby shell, and it's actually not a valid audit finding.

And, of course, that's completely omitting the binary collision issue because frankly anybody with "old" rsh installed deserves whatever pain they get.


rbsh would be very recognizable for ruby users (rb being the file extension commonly used)


rbsh is actually a cool idea. I just might adopt that.


I have a script called each that executes Ruby on each line of input https://rubygems.org/gems/dorian-each


I think this is not a general shell like bash or csh, more of a custom REPL for some specific set of commands. A critical feature of every other shell is how they handle pipes, and this one doesn't seem to have gotten that far yet.

Perhaps it would have been better to wrap the limited shell functionalities in in gem instead, and run that inside `irb`. Currently the majority of the lines appears to be reimplementing a REPL, but those would come for free with `irb`.


Nope. It handles pipes and everything else as it shells out on system()


But the outputs of those system() calls aren't accessible to rsh, unlike other shells where I might be able to do VARIABLE=$(command). I was looking for something more like IO.popen() and rsh does not seem to have those.


Just a little screen recording of what we can expect would be awesome



That's an excellent request. Thanks. Will do.


Not sure if you've come across asciinema [1] before. I haven't used it myself, but it seems pretty popular for this kind of screen recording.

[1] https://asciinema.org/


Thanks. Will check that out.


It uses system which calls sh. So a script might behave differently on different systems.


For the rest it looks good. I have a knack for stack based languages. I enjoy it includes one.


Nice gem from the ruby world.


How fast(or slow...) is the startup time?


Haven’t tried this project yet, but the Ruby interpreter itself starts up very quickly, so I’d expect it to be essentially instant on modern hardware.


Need windows version. Windows Terminal is the worst thing in the world.


Not the same thing though. Windows Terminal is a terminal emulator. Rsh is a shell. Assuming rsh runs fine on windows, one could make another profile in Windows Terminal that starts in rsh.


WSL and you just can completely avoid Windows Terminal if you work on Windows but not with Windows. I.e I do devops, linux development in my Windows Box running an openSUSE box in WSL. It integrates pretty well with visual code for instance.


Sadly, to use WSL effectively, you need to configure high enough Disk and Memory, the issue is WSL doesn't know how to clean up deleted volume.


I'm using it since WSL1 and never had problem with that...


Or dual boot (:


Windows Terminal is just a "terminal emulator", if you can, try [pwsh7](https://github.com/PowerShell/powershell/releases)


Isn't this gem cross-platform?


Should be. Anyone with Windows, please do try, and I would be grateful for a quick report.


Once it's on Windows you can add it as a shell in Windows Terminal.

You might be mixing up cmd with windows terminal though. Cmd is truly crap which is why it was replaced with powershell 20 years ago.


CMD wasn’t replaced. PowerShell exists alongside it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: