• Welcome to Valhalla Legends Archive.
 

HeXinG vertybyte

Started by ](iller, July 02, 2005, 09:02 PM

Previous topic - Next topic

MyndFyre

omg you guys, I seiously can't see the bashing of the Windows shell.  You obviously just don't know how to use it to its fullest potential of you aren't getting what you want out of it.

The Windows command prompt is far superior to the old DOS command prompt, which was good then, too.  :)
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Kp

#31
Quote from: MyndFyre on July 05, 2005, 10:26 AM
omg you guys, I seiously can't see the bashing of the Windows shell.  You obviously just don't know how to use it to its fullest potential of you aren't getting what you want out of it.

The Windows command prompt is far superior to the old DOS command prompt, which was good then, too.  :)

No question that Windows cmd.exe outperforms the old DOS shell, but I haven't managed to get cmd.exe to do quite a lot of things that are native in tcsh.  For instance:

  • Fine-grained history substitution:
    > echo Foo
    > ^Foo^real^
    > strings -a `where !:0` | grep !:1
    should produce:
    Foo
    real
    realloc
    by way of echoing Foo, then performing an in-place substitute to re-execute the echo with "real" as an argument, and finally performing an invocation of strings against echo, wherever where happens to find it, and grepping the result for real (which finds realloc, since echo apparently imports that).  This example also demonstrates using the output of one command to supply arguments to another command.
  • Job control.  How do I suspend a running console process, and resume it later?  In tcsh, it's as simple as hitting ^Z to send a SIGTSTP.
  • Job chaining.  How to execute a sequence of commands, possibly conditional upon the success/failure of prior commands, even if some of the commands consume input?  Typing ahead won't work if the early commands consume text.  In tcsh, I'd just do:
    sleep 5; echo Foo; /bin/false || echo Bleh; /bin/true && echo Neat
    which would sleep 5 seconds, then echo Foo, then echo Bleh, then echo Neat.  /bin/false always "fails", so the || causes the shell to run the second command.  /bin/true always "succeeds", so the shell proceeds onward.  If I'd written /bin/false && echo Secret, it wouldn't print anything since false failed, and thus the conditional was immediately false without evaluating the echo.
  • Background execution.  I could do svn up >& update.log & to turn loose a Subversion update job in the background, saving all its output to a file, and leaving my command shell free for other commands.  Windows could support this via the DETACHED_PROCESS / CREATE_NO_WINDOW options to CreateProcess(), but I don't think cmd.exe provides any way to use those.
  • History memory.  How to repeat a command I'd typed just before I logged out and rebooted?
  • Automatic events.  How to cause the command window's title to automatically change as I move around directories?  tcsh can do this by embedding a control string in the $prompt variable
  • Completion.  When I execute a completion operation in cmd.exe, it kills everything on the line to the right of my cursor.  tcsh doesn't damage any arguments which occur elsewhere on the line.
  • Custom completions.  In tcsh, I can write a rule which directs the shell to offer me hostnames to ssh, instead of files, for which ssh would have no use.  A similar rule would apply to telnet if I actually used any unsecured servers.  Can cmd.exe take custom rules, or is it doomed only to offer filenames?
  • Listing: seek user assistance.  tcsh can be set to prompt me for more input when I ask for a completion on an ambiguous substring (for instance, type b when both blah and bleh are in the directory: it'll fill in the l, then ask for guidance on which I want, including optionally printing the candidates that it wants me to choose from).
  • Completion exclusions: define file extensions (or, via custom completions, much more elaborate rules) for which file patterns not to offer.  For instance, a rule that directs the shell not to offer .obj files when performing filename completions for starting a text editor.
  • Spelling correction.  The shell can identify when I misspelled a command and prompt me to fix the name without needing to retype it (or re-execute it with history substitutions)
  • Decent command line editing.  By binding a key to tcsh's backward-delete-word option, I can kill out one logical word without damaging the rest of the command line.  I've never seen cmd.exe do anything less than kill a full command line (which tcsh can also do via kill-line, of course).  I can also direct it to re-insert recently used text, such as the last word of the prior line or the most recent word of this line.
  • Extensive globbing support: use [] to denote a set of alternatives, for instance deleting anything matching bl<vowel>h (not using [] notation here so forum doesn't act strangely).
  • In-place early expansion.  I can request that the shell immediately evaluate and expand an environment variable or file glob, so that I can review its effect before executing the command (useful if you're about to turn loose something destructive and want to make absolutely certain you haven't named anything you want to save).
  • Aliasing.  I can do alias foo 'bar -x \!*' to create a rule which runs bar with the -x option, and any arguments I supplied, when I type foo.  For instance: type foo beh, get bar -x beh.
  • True scripting support, via constructs such as if/then, while, switch.  Emulating this in Windows batch jobs is a huge mess, when it can be done at all.
  • Redirect stderr.
  • Query and print the exit code of sub-processes.
  • Per-user initialization via .files in each user's home directory.  These files allow users to customize their shell behavior using all of the abovementioned features.

There are some other nice features, but this covers the highlights of which I make regular use. :)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Networks

Quote from: LoRd[nK] on July 05, 2005, 09:25 AM
You guys must be extremely lonely.

Good god Kp, it's just a command prompt!

Kp

Quote from: Networks on July 06, 2005, 12:03 PMGood god Kp, it's just a command prompt!

So?  Given a tcsh, I can manage content faster and more reliably than someone using Windows Explorer or similar clones.  Good tools make the difference between spending your time working and spending it fighting the system for compliance.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Joe[x86]

This is classic. Oh, and Eric Evans, I'm loving BBBBv2.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

|