http://www.perlmonks.org?node_id=1038600


in reply to Re^10: What's wrong with @ARGV - or with me?
in thread What's wrong with @ARGV - or with me?

This one does still puzzle me, because: arrows,home/end,pgup/pgdown work the same in most linux terminals as in the windows commands prompt (though I do admit that some may not be set up right by default).

Really? Every *nix console I've ever tried to use generates ansi escape sequences for arrow keys etc. Whilst I did go through the process (with the help of a long-time *nix user) of trying to configure the keyboard to my expectations; we got some of it to work (kind of) and other bits never at all.

For example:

  1. The backspace/back-arrow/run-out) key should delete the presceding character; and <delete> should delete the character under the cursor; but we could never get both to function correctly.
  2. When line-editing, ctrl + left-arrow/right-arrow move back/forward 1 "word" at a time -- these are amongst my most used keys but I never did find a way to make them work the same in a *nix shell.
  3. escape clears the command line. Never got that to work.
  4. I'm sure there were others, but my memory fails me.
The functions keys in the command prompt do not appear to do anything remotely similar to what they do in other apps. (F3 isn't search like it is in most apps, F4 does some delete thing which I've never seen anywhere else)

I agree that F3:search for a character in the current line; and F8:search for a previous command that begins with what you;ve currently typed; are logically transposed, but if you are used to them...

Cut and paste is probably just familiarity; I very much prefer being able to just select with the mouse and right-click to paste over have to explictly click "mark" first.

Go into the command window properties->defaults->options tab and select the "quick-edit mode" and you can do exactly that in every command window thence forth. (I've had it that way for so long I'd forgotten it wasn't then default. :)

The main problem with c&p under nix shells was that they don't (or I never worked out how to make them) inter-operate with other programs. Ie. I couldn't easily copy from a shell and paste into an editor or browser; or vice versa.

Command history seems a lot more powerful in bash; cmd seems limited to a simple up/down arrow? But that might be another simpler-is-better thing for you?

Many people have never discovered the following functions:

UP and DOWN ARROWS recall commands; ESC clears command line; F7 displays command history; ALT+F7 clears command history; F8 searches command history; F9 selects a command by number; ALT+F10 clears macro definitions.

Another factor that many people miss is that cmd.exe uses multiple histories. So text entered to program prompts doesn't get mixed in with commands typed into the shell itself. And if you re-run a command, uparrow recalls text supplied to that program *only*. Run a different program that prompts for input a second time and it will recall only text entered to that program. I believe *nix programs can arrange to have their own separate histories; but if they don't you're stuffed.

But yes, in part, it is the simplicity that I like. I just re-read a guide to bash history facilities and have trouble imagining what use I would put most of them them to -- assuming I could remember them in the first place.

Overall that was a very enlightening answer. I'd been trying to think of functionality that was _missing_ from bash, while it turned out to be not about that at all.

Thanks for asking a good question and avoiding the usual "my god is better than your god" argument :) It is nice to have a civilised discussion.

Indeed, I think most people's reaction is haw could you possibly prefer something so simple minded as cmd.exe; completely missing the 'because it is simple' possibility :)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^12: What's wrong with @ARGV - or with me?
by Crackers2 (Parson) on Jun 12, 2013 at 23:00 UTC
    The backspace/back-arrow/run-out) key should delete the presceding character and delete the character under the cursor, but we could never get both to function correctly.

    That's what it's doing by default for me in bash on linux. Of course things like this are really related to the terminal, not the shell; cmd doesn't have the separate concepts.

    When line-editing, ctrl + left-arrow/right-arrow move back/forward 1 "word" at a time -- these are amongst my most used keys but I never did find a way to make them work the same in a *nix shell.

    Ah yes. I do remember these now from the Borland IDE days. That same functionality is alt-b/alt-f in bash

    escape clears the command line. Never got that to work.

    Didn't know that one. I've always just used Ctrl-C in both windows and linux to get a new empty prompt

    Go into the command window properties->defaults->options tab and select the "quick-edit mode" and you can do exactly that in every command window thence forth. (I've had it that way for so long I'd forgotten it wasn't then default. :)

    Ah that does improve things some. Though the rectangular select (as opposed to the default stream-like select in bash) makes it still mostly useless to me except in a few specific situations. Got any way to get the other kind of select?

    The main problem with c&p under nix shells was that they don't (or I never worked out how to make them) inter-operate with other programs. Ie. I couldn't easily copy from a shell and paste into an editor or browser; or vice versa.

    That seems to be mostly an X problem. I think that's gotten better over the years but can't vouch for it. I personally run PuTTY on windows to log into a linux box, so cut and paste between everything works just fine.

    Many people have never discovered the following functions:

    Indeed. In bash they're not function keys. "history" to display command history, Ctrl-R for incremental search in the history, "history -c" to clear

    Another factor that many people miss is that cmd.exe uses multiple histories. So text entered to program prompts doesn't get mixed in with commands typed into the shell itself.

    Heh that's different. In linux the shell never even sees the stuff typed once a program starts, so it can't keep a history. It'd indeed be up to the separate program to provide it. For me in practice that's not an issue since 99% of everything i run in the shell is either non-interactive or curses-like (e.g. vi), but yes it sounds like it could be convenient for interacive stuff.

    Oh, one more thing that frustrates me about the command prompt: Can't resize it by simply dragging the window corner. If you make it smaller you get scroll bars instead of a resized buffer, and trying to make it bigger than the screen buffer size simply doesn't do anything.

      things like this are really related to the terminal, not the shell; cmd doesn't have the separate concepts.

      Indeed. Whilst things like rcmd.exe and PsExec.exe are available to give remote command line shells, Windows takes a different tack to accessing remote resources.

      Ie. It tends to run local processes that can access and change the resources on the remote machine. Each model has it pros and cons.

      Though the rectangular select (as opposed to the default stream-like select in bash) makes it still mostly useless to me except in a few specific situations. Got any way to get the other kind of select?

      Not that am aware of, but I've never found it to be a limitation. 'cept maybe occasionally having to trim a copied command prompt after paste but before hitting enter.

      I personally run PuTTY on windows to log into a linux box, so cut and paste between everything works just fine.

      You mean you never run *nix as a local OS?

      one more thing that frustrates me about the command prompt: Can't resize it by simply dragging the window corner.

      Hm As default that is true, but I have it configured ( properties->defaults->layout ) to use a 1000x1000 buffer, which means I can just drag to resize my window.

      I don't have the aversion many people seems to have to scroll bars and horizontal scrolling. And most f the time my COmmand shell windows -- along with most every other application I use -- is maximised. I switch between them using Alt-Tab as needed.

      But different strokes for different folks. :)


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Not that am aware of, but I've never found it to be a limitation.

        Two main reasons: first one's effort; to select a line I just have to click and move down a tiny bit, as opposed to click and move all the way to the right. Second one is when copying multiple lines where start of the first line doesn't start at the left; you'd have to copy the whole line and trim.

        Again nothing earth-shattering but enough to annoy me immensely

        You mean you never run *nix as a local OS?

        Correct. I play games on my desktop so windows is pretty much a requirement, and laptop is a company machine with a standard windows image. I have run a linux GUI at times but never found a reason to use it over the windows one.

        I don't have the aversion many people seems to have to scroll bars and horizontal scrolling

        I find it rather convenient to be able to keep everything visible on the screen at once; with 4 windows I could get 45 visible columns each, which would hide a lot of information if it doesn't wrap. Different use cases again I guess.

Re^12: What's wrong with @ARGV - or with me?
by Anonymous Monk on Jun 12, 2013 at 23:46 UTC

      Not helpful.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.