Hacker News new | ask | show | jobs
by near 3666 days ago
It's really, really, really, really really bad.

It doesn't even have a logical history. Despite having used it for many years, I still don't understand why when I type one command (eg make), and then another (eg out.exe), I have to toggle between pressing up or pressing down from the new command-prompt to access the previous commands.

I can't make the window more than 80-characters wide dynamically. (I don't want to change settings and restart the program to get the width to change.) So any time I want to copy and paste one of the infamous wall-of-text C++ template errors, I have to waste a lot of time reformatting the text.

Copy-and-paste as well is just complete garbage that takes forever.

I have to dump batch files into a folder in PATH because there's no alias support nor .profile startup script.

I can't color-code the prompt separately for visibility. There's no tab-completion. There's no shell escaping backticks. On and on.

Batch scripts are just hopelessly broken. It really feels like we're abusing the hell out of them to do things they were never intended to do. The language is closer to Malbolge than C.

PowerShell is a whole other can of worms. I don't care for it either, but that'd be a separate discussion.

Bash on Windows sounded promising, up until "Windows 10 only" and "doesn't play nice with the regular Windows environment."

6 comments

Joining in the "I agree, but..."

> It doesn't even have a logical history. Despite having used it for many years, I still don't understand why when I type one command (eg make), and then another (eg out.exe), I have to toggle between pressing up or pressing down from the new command-prompt to access the previous commands.

With readline-style editing, as in bash, when you go back to an earlier command and re-run it, it is added to the end of the history and your "position" in the history is reset to the end. So if you want to go back to an earlier command again, you always hit "up".

In cmd.exe, when you go back to an earlier command and re-run it, you are simply going back to that earlier position in the history. When you run it, your location in the history is now immediately after the command you just ran. So to run the following command again, you now hit "down" rather than "up".

I think it's pretty logical and I actually quite like it (after the first half an hour of familiarisation, each time I have to use it). It's just different.

I also genuinely like PowerShell, but I'm with you on everything else.

> I think it's pretty logical and I actually quite like it (after the first half an hour of familiarisation, each time I have to use it). It's just different.

Interesting! I never realized the logic behind it, thanks for expanding on it.

I definitely don't care for it at all. Much easier for my mind to think of the list of previous commands as a straight list, than trying to conceptualize 'where I am at' in my list of previous commands, and how executing a new command would then jump me somewhere else entirely. But I'll respect your difference of opinion.

(replying to myself!)

> I also genuinely like PowerShell

To expand on this. As a Unix user with decades of experience writing shell, I find it easier to write a shell script than a PowerShell one for any given job. But I am a lot more confident that the PowerShell one will work correctly.

I take care with argument handling and the like in my scripts, but I still feel that testing a shell script with a specific set of inputs only really tells me whether it works with that set of inputs. It's almost certainly possible to craft an alternative set of inputs that will break it. I don't feel that way about PowerShell.

On the other hand, I do find it much easier to reason about performance with shell scripts. Their simple streaming structure parallelises well and the individual commands have generally predictable performance and scaling characteristics. I'm a lot less confident about that aspect of PowerShell.

"I have to dump batch files into a folder in PATH because there's no alias support nor .profile startup script."

https://msdn.microsoft.com/en-us/library/windows/desktop/ms6...:

"Console aliases are used to map source strings to target strings. For example, you can define a console alias that maps "test" to "cd \a_very_long_path\test". When you type "test" at the command line, the console subsystem expands the alias and executes the specified cd command. To define a console alias, use Doskey.exe to create a macro, or use the AddConsoleAlias function."

https://www.microsoft.com/resources/documentation/windows/xp...:

"Executing registry subkeys

If you do not specify /d in string, Cmd.exe looks for the following registry subkeys: HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun\REG_SZ HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun REG_EXPAND_SZ If either one or both registry subkeys are present, they are executed before all other variables."

"There's no shell escaping backticks."

https://technet.microsoft.com/en-us/library/bb490909.aspx:

"Iterating and file parsing Use file parsing to process command output, strings and file content. […] for /F ["ParsingKeywords"] {%% | %}variable in ('command') do command [CommandLineOptions]"

Good UI? I've seen better. It also doesn't affect the conclusion that the cmd shell is bad, but the functionality does exist in some, often weirdly limited, form.

I agree it's pretty bad. But...

> I can't make the window more than 80-characters wide dynamically.

Windows 10 fixes this. You can resize the window and it wraps text better than any other terminal out there.

> Copy-and-paste as well is just complete garbage that takes forever.

Turn on Quick Edit. Now drag to select and right click to copy.

> There's no tab-completion.

Tab completion for filepaths works quite well for me.

The quick edit copy is ridiculous, it inserts newlines between one line of output if it wrapped instead of obligingly copying the content as it was sent to stdout. The selection mechanism makes nearly no sense, why would I want to select text by a rectangle?!
Windows 10 has been out for almost a year now. The selection is no longer a rectangle.
> Windows 10 fixes this. You can resize the window and it wraps text better than any other terminal out there.

Don't want to derail with Windows 10 arguments, but for me, that's a total deal breaker at this time. But thanks for pointing it out! Now if I find out Windows 10 can handle LF-formatted text in Notepad, I'll have to check and see if Hell froze over :P

> Turn on Quick Edit. Now drag to select and right click to copy.

It's not just having to go to the menu to click edit, it's that it bounds selections as a rectangular box when you paste the results. I also don't like the way quick-edit is so quick to select white blocks just by clicking in the window without dragging. Then to get rid of it, I have to right-click and kill whatever was in my clipboard. A bit OCD there, but ... I like bash a whole lot more. Normal text highlight, middle-click to paste what was highlighted elsewhere, and it's formatted properly. This is especially important when copying those 200-character long C++ template error messages.

> Tab completion for filepaths works quite well for me.

...... indeed there is. How in the world did I miss this?! Very sorry, I can't edit the parent post to fix this now.

>Don't want to derail with Windows 10 arguments, but for me, that's a total deal breaker at this time.

I'll bite. What's holding you back? Ever since 7 / 8.1 got telemetry backported in, they're on equal footing with 10 from a privacy standpoint. I guess you could cherry-pick out which windows updates you want to install, but that's frankly unsustainable.

You may as well get the new WDDM, the new DirectX 12, the new virtual desktop support, the new command prompt, and all of that.

>if I find out Windows 10 can handle LF-formatted text in Notepad, I'll have to check and see if Hell froze over :P

It doesn't, and it hasn't :P

Love your work by the way. bsnes/higan is a significant contribution to the human race.

> Ever since 7 / 8.1 got telemetry backported in, they're on equal footing with 10 from a privacy standpoint.

I primarily run FreeBSD. But when I run Windows, it's a fresh SP1 install with updates disabled. I am not worried about the safety of it. I have a firewall, behind a router, and I don't install much of anything. I just use Windows for chatting and browsing online, watching streaming media services, etc. If something were to become compromised, I'd just wipe the drive with nothing of value lost or stolen in the process. I have another Windows box that doesn't even have internet access that is solely used to build and release Windows ports of my software.

Telemetry is part of it. I also find the interface ugly as sin (duller than Windows 3.1), don't like how bloated it's becoming (Metro tiles, Cortana, etc), don't like how difficult it is to disable updates, etc.

To be honest, if I had my way, I'd be on Windows XP (classic mode) still for what I use Windows for. The main draw to 7 was that XP's 64-bit drivers were mostly garbage or just plain unavailable; and I have lots of RAM and like the speed boost for 64-bit software too much.

> Love your work by the way.

Thank you very much! But ...

> bsnes/higan is a significant contribution to the human race.

I don't know about all that o_O'

At the end of the day, it's just video games.

I use Notepad2 as a Notepad replacement (no tabs, etc), and it handles LF only just fine.
> Turn on Quick Edit. Now drag to select and right click to copy.

Command line + mouse = GUI, not command line.

Then turn on "Extended text selection keys" and you can use shift with arrows to select and ctl-c to copy.
I'm curious, how do you copy and paste in Bash without a GUI?
Let's say you want to copy and paste something from an earlier command line entry and put it in a new command line entry:

  % set -o vi
  % # hit ESC to go into vi cmd mode, hit k a few times until
  % # you get to this old command in your command history:
  % longasscommand -with -params -i super.dont -w ant2 -type in -again
  % # you want just the stuff from -params to ant2, so you
  % # type "f-n" to get the cursor to -params, then "yf2"
  % # to copy everything from there to -w ant2
  % # now you type j a couple times to go back down to
  % # the line you were working on:
  % longasscommand -with -oh jesus -not this.shit -again
  % # now you hit "f-nn" to put the cursor on the -not
  % # type "dW." to get it just so:
  % longasscommand -with -oh jesus -again
  % # now you're ready to paste in your copy after jesus
  % # so you type p, and it's inserted where you left the cursor:
  % longasscommand -with -oh jesus -params -i super.dont -w ant2 -again
You can use screen or tmux to copy and paste from anything on the screen, including using the mouse. It's really out of the purview of bash, tho.

Really handy tools on the Mac are pbpaste which sends any text in the system clipboard to stdout and pbcopy, which you can prolly guess at.

>set -o vi

I don't know how I lived without knowing that this is a thing.

It's not about GUI, but about not using mouse.
You don't need a mouse for the Windows command prompt. You just need to turn on an extra option. I don't see the problem here.
Ok then, how do you copy and paste without using a mouse in Bash?

Edit: this is in reply to the comment at the same level of this one, can't hit reply on it

can't hit reply on it

There's an anti-flamefest delay on comment threads: you can't reply to comments younger than a few (5?) minutes. However, if you go to the comment directly (click on the timestamp next to it), you do get the option to reply immediately.

I still don't understand why [..] I have to toggle between pressing up or pressing down from the new command-prompt to access the previous commands.

It is because the shell history has its own completely invisible cursor, and the cursor is not reset after a command. So when you press <up> three times, then press <enter>, your history cursor is still at -3 (actually, -4). If you then want to move to command -2, you need to press <down> instead of <up>.

The real fun comes when you edit commands in your history (so press <up>, then edit the command line). I'm still not quite sure how Microsoft handles that.

Playing with the F7 key in your command shell (https://msdn.microsoft.com/en-us/library/windows/desktop/ms6...) will likely help you gain insight, if only temporarily.
I'm not going to argue that it isn't bad, because it is, but it does have tab completion - not sure what you mean there.

Also, you can use F7 to browse your command history - that may help a bit.