Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: beginners trap: one liner

by footpad (Abbot)
on Jan 03, 2020 at 20:02 UTC ( #11110908=note: print w/replies, xml ) Need Help??


in reply to Re: beginners trap: one liner
in thread solved: beginners trap: one liner

Actually, the behavior on Windows (10, 1903 edition) appears to depend on one's shell.

I ran toohoo's test in different "command windows" on my Windows laptop.

Here's what I found:

  • Command prompt (CMD): printed nothing with a line feed.
  • Git bash: printed the message and added a line feed.
  • WSL: bash prompt: printed the message with no line feed.
  • PowerShell prompt1: printed nothing.

I don't think these results surprise anyone familiar with how Windows has implemented some of these things; however, the variation may surprise a few others.

(Oh, should mileage vary [likely], I suppose it's worth mentioning that I have two copies of perl installed on my laptop: the one provided with git bash and a relatively recent copy of Strawberry perl.)

Hope this helps...

-- f

1 - There are multiple versions of PowerShell available; I use generally use Core, but the same behavior was seen in the Desktop version as well.

Replies are listed 'Best First'.
Re^3: beginners trap: one liner
by ikegami (Pope) on Jan 04, 2020 at 06:09 UTC

    I'm not aware of any native port of bash. The two you mention specifically run in unix emulations (MSYS and WSL specifically), not Windows.

      You may be right about that (though I think you'd get some pushback from members of the WSL team, especially since you can bring bring own distro to your WSL instance.)

      Given today's cloud connected world (where Macs, PCs, and VMs need to integrate on a daily basis), it seems overly silly (to me) to be overly pedantic about such things.

      From a practical standpoint, the observed results remain the same. If we're going to help people with the problems they see, I think we should learn as much as we can about the tools they use.

      That's my take; you're perfectly free to disagree.

      --f

        From a practical standpoint, the observed results remain the same.

        I didn't contradict the results. It is indeed based on the shell (and not just in Windows). I just protested your claim that pryrt was wrong.

        (As an aside, did you know that Windows programs must parse their own command lines for arguments? That means that somewhere along the process of a cygwin program calling a Windows program, there must be a step that involves generating a Windows-compatible command line from the one actually used. Fun.)

        If we're going to help people with the problems they see, I think we should learn as much as we can about the tools they use.

        That's why I spoke up. Claiming that running a GNU/Linux program is running a Windows program doesn't help anyone. One should be aware that one is running a program in a virtual box when one does so because there are ramifications.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11110908]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2021-04-13 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?