Questions about windows support

Nick Sabalausky a at a.a
Tue Feb 21 16:45:36 PST 2012

"H. S. Teoh" <hsteoh at> wrote in message 
news:mailman.829.1329869699.20196.digitalmars-d at
> On Tue, Feb 21, 2012 at 06:49:45PM -0500, Nick Sabalausky wrote:
> [...]
>> I think that globbing should be done explicity by the app, *but* for
>> apps that don't play ball you should be able to *explicitly* do it at
>> the command line. Example:
>> $someutil *.txt foo.html
>> ERROR: Can't find file '*.txt'
>> $glob *.txt
>> 'hello.txt' 'Modern File Name.txt' 'another.txt'
>> $someutil `glob *.txt` foo.html
>> Processing hello.txt...done
>> Processing Modern File Name.txt...done
>> Processing another.txt...done
>> Processing foo.html...done
> Hmm. I like that idea: have the shell *not* interpolate things by
> default, unless you explicitly say to do so. So by default typing:
> rm *.txt
> will pass "*.txt" to rm as a single argument, whereas:
> # Not real syntax:
> rm `*.txt`
> will expand "*.txt" as a glob and pass the result to rm.
> [...]
>> Which brings up another little nitpick: When bash displays a prompt,
>> it should first check to see if the last char output was a newline. If
>> not, it should...ADD ONE!
> [...]
> Yeah I agree with that one. Unfortunately I don't think it can tell,
> because the previous command writes to stdout directly (it doesn't go
> through bash -- else it's be too inefficient, you'd have processes
> copying stuff from each other all over the place). The terminal doesn't
> let you ask "what was the last char sent to you?".
> Having said that, though, the terminal *does* have an escape sequences
> (yeah, ugh) that bash *could* use to find out where the cursor is, and
> if it's not at column 0, insert a newline.
> Unfortunately, us old hands have gotten so used to this misbehaviour
> that we actually *use* it to detect whether something has a newline at
> the end or not. Another of those historical accidents calcified before
> it can be disinfected.

Windows's cmd.exe always inserts a newline right before a command prompt. So 
you get the best of both worlds. Only issue is you end up with excess 
newlines. For example, you get:

C:\>echo Hello > filea.txt

C:\>echo Hello > fileb.txt


C:\>cd foo



Instead of:

~$echo Hello > filea.txt
~$echo Hello > fileb.txt
~$cd foo

But maybe that's not quite as bad?

Come to think of it, bash should be able to do the same thing if you add a 
newline to the beginning of $PS1...

Ha! It does work! Boy is that funny, it makes bash look like windows :) 
That's just weird.

But, of course, it does mean a lot of extra blank lines. Which is ugly if 
you're doing a lot of no-output commands. But then, it's also much easier to 
read when there's a lot of heavy-output commands. It's a tradeoff :/

More information about the Digitalmars-d mailing list