Windows PowerShell vs. bash examples - Linux

This is a discussion on Windows PowerShell vs. bash examples - Linux ; On 2008-11-05, Steve Townsend wrote: > Chris Ahlstrom writes: > >> After takin' a swig o' grog, Tom Shelton belched out >> this bit o' wisdom: >> >>> On Nov 5, 12:35┬*pm, Chris Ahlstrom wrote: >>>> >>>> Can you djinn ...

+ Reply to Thread
Page 5 of 11 FirstFirst ... 3 4 5 6 7 ... LastLast
Results 81 to 100 of 217

Thread: Windows PowerShell vs. bash examples

  1. Re: Windows PowerShell vs. bash examples

    On 2008-11-05, Steve Townsend wrote:
    > Chris Ahlstrom writes:
    >
    >> After takin' a swig o' grog, Tom Shelton belched out
    >> this bit o' wisdom:
    >>
    >>> On Nov 5, 12:35┬*pm, Chris Ahlstrom wrote:
    >>>>
    >>>> Can you djinn up a quick one that might work? ┬*(Doesn't have to work, just
    >>>> illustrate how to use Powershell to extract the binary part and untar it.)
    >>>
    >>> The biggest problem I see is the embeded binary data. I'm not sure
    >>> how I would accomplish that, except to maybe put it in a here string
    >>> in the script and format it in hex. Believe me, I'm far from a
    >>> powershell power user - so anything I come up with might not be
    >>> optimal. But, I'll give a quick try on it latter.

    >>
    >> No need, unless you want to do it.
    >>
    >> It works in bash because bash, and the other tools (awk and tail) can handle
    >> very large "lines" of binary data. In my experience with Windows (as
    >> opposed to GNU) tools, size limits are pretty important.

    >
    > Wrong again. It is limited and why people must use xargs.


    xargs is often used in situations where you would end up building
    a single command line string that is too large for bash to handle. If
    you are streaming data, there is no reason that you can't stream it
    through bash by the gigabytes.

    A lot of files in a single directory would be the classic example.

    >
    > http://www.ss64.com/bash/xargs.html
    >



    --
    Apple: because TRANS.TBL is an mp3 file. It really is! |||
    / | \

    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    http://www.usenet.com

  2. Re: Windows PowerShell vs. bash examples

    Tom Shelton wrote:

    > On Nov 6, 1:46┬*am, Terry Porter wrote:
    >> On Wed, 05 Nov 2008 03:30:49 -0800, Kelsey Bjarnason wrote:
    >> > [snips]

    >>
    >> > On Wed, 05 Nov 2008 03:07:55 -0500, Erik Funkenbusch wrote:

    >>
    >> >>> Because I'm underwhelmed Erik. Powershell appears no better than the
    >> >>> methods Linux users have had for the last 15 years or so.

    >>
    >> >> For a trivial, contrived example. ┬*A one line command is a one line
    >> >> command, regardless of environment. ┬*It can't really get any simpler,
    >> >> or more powerful.

    >>
    >> > Err... a one-liner can be a fairly powerful critter. ┬*Try this:

    >>
    >> > " does. - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"

    >>
    >> We are all waiting for your "PowerShill" equivalent to Kelseys example
    >> Erik ...
    >>
    >> --
    >> Linux full time, on the desktop, since August 1997

    >
    > I think there is some confusion between what is bash vs what is an
    > external applicaiton. The only thing that is bash in the above is the
    > |. Bash forms the glue between the tar application and the ssh
    > application.
    >
    > So, assuming you have the tools installed on windows (on both ends of
    > the pipe), then the command would look exactly the same. Those tools
    > could be there via cygwin or maybe even SFU.
    >
    > These sort of examples do not compare shells really, the compare the
    > toolset installed.
    >


    Right. Because nobody on the linux side would be stupid enough to put all
    that duplicated functionality into a "PowerShell". The *nix way is to glue
    your needed functionality out of fine running small utilities on the spot.
    The Win-way is to construct a bloated do-it-all
    --
    Perl - the only language that looks the same before and after RSA
    encryption.
    -- Keith Bostic


  3. Re: Windows PowerShell vs. bash examples

    On 2008-11-06, Steve Townsend wrote:
    > Terry Porter writes:
    >
    >> On Wed, 05 Nov 2008 08:43:39 -0800, Tom Shelton wrote:
    >>
    >>> On Nov 5, 5:57┬*am, Chris Ahlstrom wrote:
    >>>> After takin' a swig o' grog, Kelsey Bjarnason belched out

    >>
    >>>> > tar cvzf - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"
    >>>>
    >>>> I'm wondering if you can build self-installing compressed archives
    >>>> using only Powershell and command-line commands.
    >>>>
    >>>>
    >>> Out of the box, probably not.

    >>
    >> There ya go folks, the debate is over. Kelsey has shown that the old
    >> Linux shell is still far superior to Eriks "PowerShill"

    >
    > Is this a habit in this group to talk about things you know little
    > about? That's three people at it now. You really think this one example


    This is a simple case of "put up or shut up" where the relevant party
    has been unable to "put up". Useful and interesting examples of Unix scripting
    abound. There might even be a few that seem custom made and ready to be used
    for some particular problem you have right now.

    > proves anything? FWIW, I think that some of the Linux shells (you do
    > know there are lots, right) are much better than powershell. But dont
    > try to prove it with such spurious data man.


    If spurious data is all that you have, then mundane scientific
    skepticism is entirely warranted.

    This myth is "busted" until someone comes up with a better test.

    --
    Apple: because TRANS.TBL is an mp3 file. It really is! |||
    / | \

    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    http://www.usenet.com

  4. Re: Windows PowerShell vs. bash examples

    On 2008-11-06, Tom Shelton wrote:
    > On Nov 6, 1:49*am, Terry Porter wrote:
    >> On Wed, 05 Nov 2008 08:43:39 -0800, Tom Shelton wrote:
    >> > On Nov 5, 5:57*am, Chris Ahlstrom wrote:
    >> >> After takin' a swig o' grog, Kelsey Bjarnason belched out
    >> >> > tar cvzf - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"

    >>
    >> >> I'm wondering if you can build self-installing compressed archives
    >> >> using only Powershell and command-line commands.

    >>
    >> > Out of the box, probably not.

    >>
    >> There ya go folks, the debate is over. Kelsey has shown that the old
    >> Linux shell is still far superior to Eriks "PowerShill"
    >>

    >
    > So tell me, Terry - how do you do it in bash? Wait, you don't - bash
    > relies on external tools to do those things. Bash is a way to glue a
    > bunch of things together, as is Powershell. The problem here is not
    > so much bash vs powershell, but the availability of tools. And no one
    > is claiming that windows comes with more commandline tools then Linux
    > - it doesn't.


    That is a fact that should not be ignored just to make PowerShell
    appear to be something that it is not. It should be no surprise that
    once again NT suffers for not being Unix. The idea of stringing
    together Win32 style system hooks doesn't seem to be nearly as nifty
    as that same idea in Unix.

    It's more like doing posix C calls from within bash.

    [deletia]



    --
    Apple: because TRANS.TBL is an mp3 file. It really is! |||
    / | \

    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    http://www.usenet.com

  5. Re: Windows PowerShell vs. bash examples

    On Nov 6, 10:46*am, Peter K÷hlmann wrote:
    > Tom Shelton wrote:
    > > On Nov 6, 1:46*am, Terry Porter wrote:
    > >> On Wed, 05 Nov 2008 03:30:49 -0800, Kelsey Bjarnason wrote:
    > >> > [snips]

    >
    > >> > On Wed, 05 Nov 2008 03:07:55 -0500, Erik Funkenbusch wrote:

    >
    > >> >>> Because I'm underwhelmed Erik. Powershell appears no better than the
    > >> >>> methods Linux users have had for the last 15 years or so.

    >
    > >> >> For a trivial, contrived example. *A one line command is a one line
    > >> >> command, regardless of environment. *It can't really get any simpler,
    > >> >> or more powerful.

    >
    > >> > Err... a one-liner can be a fairly powerful critter. *Try this:

    >
    > >> > " does. - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"

    >
    > >> We are all waiting for your "PowerShill" equivalent to Kelseys example
    > >> Erik ...

    >
    > >> --
    > >> Linux full time, on the desktop, since August 1997

    >
    > > I think there is some confusion between what is bash vs what is an
    > > external applicaiton. *The only thing that is bash in the above is the
    > > |. *Bash forms the glue between the tar application and the ssh
    > > application.

    >
    > > So, assuming you have the tools installed on windows (on both ends of
    > > the pipe), then the command would look exactly the same. *Those tools
    > > could be there via cygwin or maybe even SFU.

    >
    > > These sort of examples do not compare shells really, the compare the
    > > toolset installed.

    >
    > Right. Because nobody on the linux side would be stupid enough to put all
    > that duplicated functionality into a "PowerShell". The *nix way is to glue
    > your needed functionality out of fine running small utilities on the spot..
    > The Win-way is to construct a bloated do-it-all


    That makes no sense. Powershell is a shell. Nothing more nothing
    less. The big difference between bash and powershell is not the tools
    installed, but the way that it processes it's pipeline. It's also
    very extensible and was designed to have an "elastic" syntax. But,
    it's philosophy is very *nix like - glue together your functionality
    with small utilities. The guys that created this thing are former
    Unix guys, and originally the powershell language was based on Perl.

    A quick check shows my Powershell v1 ships with 129 commandlets. I
    believe they are adding 30 or 40 more for version. Sure doesn't sound
    like "do-it-all" approach. If you need other utilities, you can
    create custom commandlets, use .net objects or com objects.

    I understand that PowerShell is not likely to be a tool of choice for
    you or other Linux users. It is not cross platform (at least not
    yet). I'm only interested in a comparison of the shells on a
    technical level - and I think there are some interesting aspects of
    the way powershell works in comparison to bash. But, if this is going
    to be the normal "if it's from ms it sucks" routine, then I'm really
    not interested in continuing the discussion.

    --
    Tom Shelton

  6. Re: Windows PowerShell vs. bash examples

    On Nov 6, 10:54*am, JEDIDIAH wrote:
    > On 2008-11-06, Tom Shelton wrote:
    >
    >
    >
    > > On Nov 6, 1:49*am, Terry Porter wrote:
    > >> On Wed, 05 Nov 2008 08:43:39 -0800, Tom Shelton wrote:
    > >> > On Nov 5, 5:57*am, Chris Ahlstrom wrote:
    > >> >> After takin' a swig o' grog, Kelsey Bjarnason belched out
    > >> >> > tar cvzf - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"

    >
    > >> >> I'm wondering if you can build self-installing compressed archives
    > >> >> using only Powershell and command-line commands.

    >
    > >> > Out of the box, probably not.

    >
    > >> There ya go folks, the debate is over. Kelsey has shown that the old
    > >> Linux shell is still far superior to Eriks "PowerShill"

    >
    > > So tell me, Terry - how do you do it in bash? *Wait, you don't - bash
    > > relies on external tools to do those things. *Bash is a way to glue a
    > > bunch of things together, as is Powershell. *The problem here is not
    > > so much bash vs powershell, but the availability of tools. *And no one
    > > is claiming that windows comes with more commandline tools then Linux
    > > - it doesn't.

    >
    > * * That is a fact that should not be ignored just to make PowerShell
    > appear to be something that it is not. It should be no surprise that
    > once again NT suffers for not being Unix. The idea of stringing
    > together Win32 style system hooks doesn't seem to be nearly as nifty
    > as that same idea in Unix.
    >
    > * * It's more like doing posix C calls from within bash.
    >


    Who said anything about stringing together win32 hooks? If you
    install those tools on windows (ssh, tar, etc) on windows (cygwin,
    maybe sfu), then you can do the exact same thing.

    Or are you thinking that you can not execute command line applciations
    in powershell? I think there are some very fundamental
    misunderstandings about what powershell is and isn't.

    --
    Tom Shelton

  7. Re: Windows PowerShell vs. bash examples

    Tom Shelton writes:

    > On Nov 6, 1:46┬*am, Terry Porter wrote:
    >> On Wed, 05 Nov 2008 03:30:49 -0800, Kelsey Bjarnason wrote:
    >> > [snips]

    >>
    >> > On Wed, 05 Nov 2008 03:07:55 -0500, Erik Funkenbusch wrote:

    >>
    >> >>> Because I'm underwhelmed Erik. Powershell appears no better than the
    >> >>> methods Linux users have had for the last 15 years or so.

    >>
    >> >> For a trivial, contrived example. ┬*A one line command is a one line
    >> >> command, regardless of environment. ┬*It can't really get any simpler,
    >> >> or more powerful.

    >>
    >> > Err... a one-liner can be a fairly powerful critter. ┬*Try this:

    >>
    >> > " does. - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"

    >>
    >> We are all waiting for your "PowerShill" equivalent to Kelseys example
    >> Erik ...
    >>
    >> --
    >> Linux full time, on the desktop, since August 1997

    >
    > I think there is some confusion between what is bash vs what is an
    > external applicaiton.


    There is no confusion. Erik specified Powershell as the most powerful
    scripting *environment*. When pressed how it would stack up to the
    scripting environment on a typical *nix box, he shifted the goalposts
    to a comparison of shells only.

    And he succeeded, because the discussion has veered away from a
    discussion of scripting *environments* to a bare feature comparison of
    *shells*.

    Powershell looks nice, a decent shell at least. But as a scripting
    environment, it still doesn't stack up to a standard Linux install,
    IMO.

    Seeing as that you know a bit more of it, how does it stack up in
    interaction with the rest of the system? I know it can handle .NET
    objects, but does that cover direct access to kernel parameters and
    events?

    Can you, say, write a Powershell script as an event handler to run on
    hardware changes? Like, e.g., changing the processor powersaving mode
    on disconnecting the AC on a laptop?

    Mart

    --
    "We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.

  8. Re: Windows PowerShell vs. bash examples

    Steve Townsend writes:

    > Chris Ahlstrom writes:
    >
    >> After takin' a swig o' grog, Tom Shelton belched out
    >> this bit o' wisdom:
    >>
    >>> On Nov 5, 12:35┬*pm, Chris Ahlstrom wrote:
    >>>>
    >>>> Can you djinn up a quick one that might work? ┬*(Doesn't have to work, just
    >>>> illustrate how to use Powershell to extract the binary part and untar it.)
    >>>
    >>> The biggest problem I see is the embeded binary data. I'm not sure
    >>> how I would accomplish that, except to maybe put it in a here string
    >>> in the script and format it in hex. Believe me, I'm far from a
    >>> powershell power user - so anything I come up with might not be
    >>> optimal. But, I'll give a quick try on it latter.

    >>
    >> No need, unless you want to do it.
    >>
    >> It works in bash because bash, and the other tools (awk and tail) can handle
    >> very large "lines" of binary data. In my experience with Windows (as
    >> opposed to GNU) tools, size limits are pretty important.

    >
    > Wrong again. It is limited and why people must use xargs.
    >
    > http://www.ss64.com/bash/xargs.html
    >


    Oh dear. Someone has heard something. Too bad it is not applicable.

    Dear idiot: xargs is meant to address the problem that the buffer size
    for the command line itself is fixed. This has nothing to do with how
    shell commands interact with STDIN.

    Come back when you actually *understand* what you parrot.

    Mart

    --
    "We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.

  9. Re: Windows PowerShell vs. bash examples

    On Thu, 06 Nov 2008 02:46:34 -0600, Terry Porter wrote:

    > On Wed, 05 Nov 2008 03:30:49 -0800, Kelsey Bjarnason wrote:
    >
    >> [snips]
    >>
    >> On Wed, 05 Nov 2008 03:07:55 -0500, Erik Funkenbusch wrote:
    >>
    >>>> Because I'm underwhelmed Erik. Powershell appears no better than the
    >>>> methods Linux users have had for the last 15 years or so.
    >>>
    >>> For a trivial, contrived example. A one line command is a one line
    >>> command, regardless of environment. It can't really get any simpler,
    >>> or more powerful.

    >>
    >> Err... a one-liner can be a fairly powerful critter. Try this:
    >>
    >> " does. - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"

    >
    > We are all waiting for your "PowerShill" equivalent to Kelseys example
    > Erik ...


    Why? Nobody asked for it. Perhaps you think I'm a mind reader. If you
    want something, ask for it, don't be an arrogant asswhipe who expects
    people to read his mind.

    If you insist, here's the powershell version of that command.

    tar cvzf - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"

    Yep, looks exactly the same, assuming the remote host is a unix host.

    But these stupid examples do nothing to show the power or flexibility of
    PowerShell, since they're just duplicating functionality on Linux.

    Let's see how much code it takes you to do something like this in Linux
    using any LDAP server of your choice. Note the iterating over a set of
    objects, note the ability to work with objects and their properties. Also
    note, that this is all shell code, not shelling out to a different
    scripting language.

    $Dom = 'LDAP://DC=scribnertechmediacorp;DC=local'
    $Root = New-Object DirectoryServices.DirectoryEntry $Dom

    $i=0

    # Create a selector and start searching from the Root of the Directory
    $selector = New-Object DirectoryServices.DirectorySearcher
    $selector.SearchRoot = $root
    $selector.set_pagesize(1000)
    $adobj= $selector.findall() |`

    where {$_.properties.objectcategory -match "CN=Person"}

    foreach ($person in $adobj){
    $prop=$person.properties
    $i++
    Write-host "First name: $($prop.givenname) " `
    "Last Name: $($prop.sn) Display Name: $($prop.cn)"
    }

    "Total LDAP Users Found: $i"

    How about this one?

    # Display all the titles from the front page of Slashdot.
    ([xml] (new-object System.Net.WebClient).DownloadString("http://rss.slashdot.org/Slashdot/slashdot")).RDF.Item| select title

    Can you do that in one line in bash, without shelling out to other tools?
    Hell, can you do it in one line even WITH shelling out to other tools?

    How about this:

    # Sort all the items in a text file and write to a new file
    get-content sort.txt | sort-object | out-file new.txt

    Again, one line, no shelling to other scripting environments.

    So what's the big deal about shelling to other scripts? Nothing, but the
    point is to show how much powerful the PowerShell itself is compared to
    other shells, not the power of third party scripting languages.

  10. Re: Windows PowerShell vs. bash examples

    On Thu, 06 Nov 2008 21:10:41 +0100, Mart van de Wege wrote:

    > There is no confusion. Erik specified Powershell as the most powerful
    > scripting *environment*. When pressed how it would stack up to the
    > scripting environment on a typical *nix box, he shifted the goalposts
    > to a comparison of shells only.


    What is a scripting environment? A shell. Duh.

    The environment is what the script runs in, not the scripting language, not
    the interpreter, etc..

    As an example, wscript is also a scripting environment, yet the languages
    it can use are plenty (vbscript, jscript, etc..)

    > And he succeeded, because the discussion has veered away from a
    > discussion of scripting *environments* to a bare feature comparison of
    > *shells*.


    The shell *IS* the scripting environment.

    > Powershell looks nice, a decent shell at least. But as a scripting
    > environment, it still doesn't stack up to a standard Linux install,
    > IMO.


    And what is your argument for that opinion?

    > Seeing as that you know a bit more of it, how does it stack up in
    > interaction with the rest of the system? I know it can handle .NET
    > objects, but does that cover direct access to kernel parameters and
    > events?


    It certainly can, if you have .NET objects that access those.

    > Can you, say, write a Powershell script as an event handler to run on
    > hardware changes? Like, e.g., changing the processor powersaving mode
    > on disconnecting the AC on a laptop?


    Yes, via WMI objects.

    However, there is little reason to have to do that particular task, since
    Windows itself can be configured to do that.

  11. Re: Windows PowerShell vs. bash examples

    On Nov 6, 1:10*pm, Mart van de Wege wrote:
    > Tom Shelton writes:
    > > On Nov 6, 1:46*am, Terry Porter wrote:
    > >> On Wed, 05 Nov 2008 03:30:49 -0800, Kelsey Bjarnason wrote:
    > >> > [snips]

    >
    > >> > On Wed, 05 Nov 2008 03:07:55 -0500, Erik Funkenbusch wrote:

    >
    > >> >>> Because I'm underwhelmed Erik. Powershell appears no better than the
    > >> >>> methods Linux users have had for the last 15 years or so.

    >
    > >> >> For a trivial, contrived example. *A one line command is a one line
    > >> >> command, regardless of environment. *It can't really get any simpler,
    > >> >> or more powerful.

    >
    > >> > Err... a one-liner can be a fairly powerful critter. *Try this:

    >
    > >> > " does. - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"

    >
    > >> We are all waiting for your "PowerShill" equivalent to Kelseys example
    > >> Erik ...

    >
    > >> --
    > >> Linux full time, on the desktop, since August 1997

    >
    > > I think there is some confusion between what is bash vs what is an
    > > external applicaiton. *

    >
    > There is no confusion. Erik specified Powershell as the most powerful
    > scripting *environment*. When pressed how it would stack up to the
    > scripting environment on a typical *nix box, he shifted the goalposts
    > to a comparison of shells only.
    >


    Hmmm... It seems to me, the dicussion always was about bash vs
    powershell.


    > And he succeeded, because the discussion has veered away from a
    > discussion of scripting *environments* to a bare feature comparison of
    > *shells*.
    >
    > Powershell looks nice, a decent shell at least. But as a scripting
    > environment, it still doesn't stack up to a standard Linux install,
    > IMO.
    >


    As a scripting environment it has access to pretty much any .NET
    library, COM library, or command line tool that you may have on your
    windows box. That covers a LOT of territory, without installing any
    3rd party tools.

    > Seeing as that you know a bit more of it, how does it stack up in
    > interaction with the rest of the system?


    I don't know that I know more of it. Eric hasn't posted a lot of
    code. I've played with it, and I use it for tasks occasionally - but,
    I'm far from an expert.

    But, I'll say this... As I mentioned above, if windows provides a COM
    interface or a command line tool is present, then you can most likely
    use it from powershell. If there is no interface or utility for a
    given operation, it's fairly trivial to write a commandlet to handle
    the job. Powershell is designed to be extensible.

    In fact there are bunch here:
    http://www.codeplex.com/PowerShellCX

    > I know it can handle .NET
    > objects, but does that cover direct access to kernel parameters and
    > events?
    >
    > Can you, say, write a Powershell script as an event handler to run on
    > hardware changes? Like, e.g., changing the processor powersaving mode
    > on disconnecting the AC on a laptop?


    I can't really comment completly on the rest of this, simply because I
    am not expert enough in powershell or bash to make that comparison.
    But, from a couple of quick looks on the web of examples of this on
    Linux - then I don't really see a reason it couldn't be used in this
    way, given the same types of interfaces.

    --
    Tom Shelton

  12. Re: Windows PowerShell vs. bash examples

    Erik Funkenbusch writes:

    > On Thu, 06 Nov 2008 21:10:41 +0100, Mart van de Wege wrote:
    >
    >> There is no confusion. Erik specified Powershell as the most powerful
    >> scripting *environment*. When pressed how it would stack up to the
    >> scripting environment on a typical *nix box, he shifted the goalposts
    >> to a comparison of shells only.

    >
    > What is a scripting environment? A shell. Duh.
    >

    For Wintendo lusers like you, maybe. Us *nix users tend to laugh at
    idiocy like this.

    > The environment is what the script runs in, not the scripting language, not
    > the interpreter, etc..
    >

    Look at those goalposts move.

    > The shell *IS* the scripting environment.
    >
    >> Powershell looks nice, a decent shell at least. But as a scripting
    >> environment, it still doesn't stack up to a standard Linux install,
    >> IMO.

    >
    > And what is your argument for that opinion?
    >

    The fact that Windows admin tools are still predominantly
    GUI-oriented. And the lack of standard CLI tools until very recently.

    One good shell does not a replacement for 30 years of tool development
    make.

    >> Seeing as that you know a bit more of it, how does it stack up in
    >> interaction with the rest of the system? I know it can handle .NET
    >> objects, but does that cover direct access to kernel parameters and
    >> events?

    >
    > It certainly can, if you have .NET objects that access those.
    >

    Keyword *If*.

    How many of those objects exist?

    >> Can you, say, write a Powershell script as an event handler to run on
    >> hardware changes? Like, e.g., changing the processor powersaving mode
    >> on disconnecting the AC on a laptop?

    >
    > Yes, via WMI objects.
    >
    > However, there is little reason to have to do that particular task, since
    > Windows itself can be configured to do that.


    In other words, Windows can't do it, so it is useless.

    Sour grapes.

    Mart

    --
    "We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.

  13. Re: Windows PowerShell vs. bash examples

    Tom Shelton writes:

    > On Nov 6, 1:10┬*pm, Mart van de Wege wrote:
    >> Tom Shelton writes:
    >> > On Nov 6, 1:46┬*am, Terry Porter wrote:
    >> >> On Wed, 05 Nov 2008 03:30:49 -0800, Kelsey Bjarnason wrote:
    >> >> > [snips]

    >>
    >> >> > On Wed, 05 Nov 2008 03:07:55 -0500, Erik Funkenbusch wrote:

    >>
    >> >> >>> Because I'm underwhelmed Erik. Powershell appears no better than the
    >> >> >>> methods Linux users have had for the last 15 years or so.

    >>
    >> >> >> For a trivial, contrived example. ┬*A one line command is a one line
    >> >> >> command, regardless of environment. ┬*It can't really get any simpler,
    >> >> >> or more powerful.

    >>
    >> >> > Err... a one-liner can be a fairly powerful critter. ┬*Try this:

    >>
    >> >> > " does. - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"

    >>
    >> >> We are all waiting for your "PowerShill" equivalent to Kelseys example
    >> >> Erik ...

    >>
    >> >> --
    >> >> Linux full time, on the desktop, since August 1997

    >>
    >> > I think there is some confusion between what is bash vs what is an
    >> > external applicaiton. ┬*

    >>
    >> There is no confusion. Erik specified Powershell as the most powerful
    >> scripting *environment*. When pressed how it would stack up to the
    >> scripting environment on a typical *nix box, he shifted the goalposts
    >> to a comparison of shells only.
    >>

    >
    > Hmmm... It seems to me, the dicussion always was about bash vs
    > powershell.
    >

    You came in several subthreads after the redirection.
    >
    >> And he succeeded, because the discussion has veered away from a
    >> discussion of scripting *environments* to a bare feature comparison of
    >> *shells*.
    >>
    >> Powershell looks nice, a decent shell at least. But as a scripting
    >> environment, it still doesn't stack up to a standard Linux install,
    >> IMO.
    >>

    >
    > As a scripting environment it has access to pretty much any .NET
    > library, COM library, or command line tool that you may have on your
    > windows box. That covers a LOT of territory, without installing any
    > 3rd party tools.


    I still question if it covers all the territory Unix environments do.

    Do remember that the system objects must expose an API for Powershell
    to interact with them. Unix has a simple byte-stream oriented API for
    almost all its system tools, and newer *nixes, including current Linux
    kernels, build on that 30-year heritage. That's hard to beat.

    >
    >> Seeing as that you know a bit more of it, how does it stack up in
    >> interaction with the rest of the system?

    >
    > I don't know that I know more of it. Eric hasn't posted a lot of
    > code. I've played with it, and I use it for tasks occasionally - but,
    > I'm far from an expert.
    >

    Yes, but as opposed to Erik, I actually believe you when you say
    you've used it. Compared to anyone else in this thread, that makes you
    an expert.

    > But, I'll say this... As I mentioned above, if windows provides a COM
    > interface or a command line tool is present, then you can most likely
    > use it from powershell. If there is no interface or utility for a
    > given operation, it's fairly trivial to write a commandlet to handle
    > the job. Powershell is designed to be extensible.
    >

    As I said to Erik, big *If*. Unix tools, if they are meant to be
    interfaced, use a simple bytestream, which is an API almost anything
    on a *nix box can handle.

    > In fact there are bunch here:
    > http://www.codeplex.com/PowerShellCX
    >
    >> I know it can handle .NET
    >> objects, but does that cover direct access to kernel parameters and
    >> events?
    >>
    >> Can you, say, write a Powershell script as an event handler to run on
    >> hardware changes? Like, e.g., changing the processor powersaving mode
    >> on disconnecting the AC on a laptop?

    >
    > I can't really comment completly on the rest of this, simply because I
    > am not expert enough in powershell or bash to make that comparison.
    > But, from a couple of quick looks on the web of examples of this on
    > Linux - then I don't really see a reason it couldn't be used in this
    > way, given the same types of interfaces.


    Yes, but Erik's insistence (and your posts as well) suggest that these
    interfaces may not exist. And worse, Windows is not designed for
    non-interactive automation (which was a major point in MS' own
    internal Hotmail migration document that's still floating around on
    the 'Net). You are beholden to others to provide an interface for
    that.

    On Linux, the kernel exposes its interfaces to userland tools as
    filesystem objects, and event-based subsystems (like device
    hotplugging, or ACPI) have the ability to call anything that can be
    exec()-ed as handlers.

    This makes for a very rich environment for system automation. I don't
    think Powershell, given its relative age, is quite there yet. It'd be
    highly unlikely if it were.

    I do believe however, if MS persists with it, that it may grow into
    that task. However, the "OH SHINY!" attitude of the MS devs is
    legendary, and there is a real risk that Powershell will end up as the
    latest prematurely abandoned good idea.

    Mart

    --
    "We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.

  14. Re: Windows PowerShell vs. bash examples

    On 2008-11-06, Tom Shelton wrote:
    > On Nov 6, 10:54*am, JEDIDIAH wrote:
    >> On 2008-11-06, Tom Shelton wrote:
    >>
    >>
    >>
    >> > On Nov 6, 1:49*am, Terry Porter wrote:
    >> >> On Wed, 05 Nov 2008 08:43:39 -0800, Tom Shelton wrote:
    >> >> > On Nov 5, 5:57*am, Chris Ahlstrom wrote:
    >> >> >> After takin' a swig o' grog, Kelsey Bjarnason belched out
    >> >> >> > tar cvzf - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"

    >>
    >> >> >> I'm wondering if you can build self-installing compressed archives
    >> >> >> using only Powershell and command-line commands.

    >>
    >> >> > Out of the box, probably not.

    >>
    >> >> There ya go folks, the debate is over. Kelsey has shown that the old
    >> >> Linux shell is still far superior to Eriks "PowerShill"

    >>
    >> > So tell me, Terry - how do you do it in bash? *Wait, you don't - bash
    >> > relies on external tools to do those things. *Bash is a way to glue a
    >> > bunch of things together, as is Powershell. *The problem here is not
    >> > so much bash vs powershell, but the availability of tools. *And no one
    >> > is claiming that windows comes with more commandline tools then Linux
    >> > - it doesn't.

    >>
    >> * * That is a fact that should not be ignored just to make PowerShell
    >> appear to be something that it is not. It should be no surprise that
    >> once again NT suffers for not being Unix. The idea of stringing
    >> together Win32 style system hooks doesn't seem to be nearly as nifty
    >> as that same idea in Unix.
    >>
    >> * * It's more like doing posix C calls from within bash.
    >>

    >
    > Who said anything about stringing together win32 hooks? If you
    > install those tools on windows (ssh, tar, etc) on windows (cygwin,
    > maybe sfu), then you can do the exact same thing.
    >
    > Or are you thinking that you can not execute command line applciations
    > in powershell? I think there are some very fundamental
    > misunderstandings about what powershell is and isn't.


    If it's not there, you can't call it.

    If we have a wrongful idea of powershell, it's entirely due to a
    poor sales effort.

    --


    Some people have this nutty idea that in 1997 |||
    reading to a hard disk and writing to a hard disk / | \
    both at the same time was something worth patenting.


    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    http://www.usenet.com

  15. Re: Windows PowerShell vs. bash examples

    "Peter K÷hlmann" stated in post
    49132d6a$0$32671$9b4e6d93@newsspool2.arcor-online.net on 11/6/08 10:46 AM:

    >> I think there is some confusion between what is bash vs what is an
    >> external applicaiton. The only thing that is bash in the above is the
    >> |. Bash forms the glue between the tar application and the ssh
    >> application.
    >>
    >> So, assuming you have the tools installed on windows (on both ends of
    >> the pipe), then the command would look exactly the same. Those tools
    >> could be there via cygwin or maybe even SFU.
    >>
    >> These sort of examples do not compare shells really, the compare the
    >> toolset installed.
    >>

    >
    > Right. Because nobody on the linux side would be stupid enough to put all
    > that duplicated functionality into a "PowerShell". The *nix way is to glue
    > your needed functionality out of fine running small utilities on the spot.
    > The Win-way is to construct a bloated do-it-all


    Isn╣t that idea of Konqueror to be a bloated do-it-all?


    --
    Dear Aunt, let's set so double the killer delete select all

    http://video.google.com/videoplay?do...21217782777472


  16. Re: Windows PowerShell vs. bash examples

    On Nov 6, 2:51*pm, Mart van de Wege wrote:
    > Tom Shelton writes:
    > > On Nov 6, 1:10*pm, Mart van de Wege wrote:
    > >> Tom Shelton writes:
    > >> > On Nov 6, 1:46*am, Terry Porter wrote:
    > >> >> On Wed, 05 Nov 2008 03:30:49 -0800, Kelsey Bjarnason wrote:
    > >> >> > [snips]

    >
    > >> >> > On Wed, 05 Nov 2008 03:07:55 -0500, Erik Funkenbusch wrote:

    >
    > >> >> >>> Because I'm underwhelmed Erik. Powershell appears no better than the
    > >> >> >>> methods Linux users have had for the last 15 years or so.

    >
    > >> >> >> For a trivial, contrived example. *A one line command is a oneline
    > >> >> >> command, regardless of environment. *It can't really get any simpler,
    > >> >> >> or more powerful.

    >
    > >> >> > Err... a one-liner can be a fairly powerful critter. *Try this:

    >
    > >> >> > " does. - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar..gz"

    >
    > >> >> We are all waiting for your "PowerShill" equivalent to Kelseys example
    > >> >> Erik ...

    >
    > >> >> --
    > >> >> Linux full time, on the desktop, since August 1997

    >
    > >> > I think there is some confusion between what is bash vs what is an
    > >> > external applicaiton. *

    >
    > >> There is no confusion. Erik specified Powershell as the most powerful
    > >> scripting *environment*. When pressed how it would stack up to the
    > >> scripting environment on a typical *nix box, he shifted the goalposts
    > >> to a comparison of shells only.

    >
    > > Hmmm... It seems to me, the dicussion always was about bash vs
    > > powershell.

    >
    > You came in several subthreads after the redirection.
    >
    >
    >
    > >> And he succeeded, because the discussion has veered away from a
    > >> discussion of scripting *environments* to a bare feature comparison of
    > >> *shells*.

    >
    > >> Powershell looks nice, a decent shell at least. But as a scripting
    > >> environment, it still doesn't stack up to a standard Linux install,
    > >> IMO.

    >
    > > As a scripting environment it has access to pretty much any .NET
    > > library, COM library, or command line tool that you may have on your
    > > windows box. *That covers a LOT of territory, without installing any
    > > 3rd party tools.

    >
    > I still question if it covers all the territory Unix environments do.
    >
    > Do remember that the system objects must expose an API for Powershell
    > to interact with them. Unix has a simple byte-stream oriented API for
    > almost all its system tools, and newer *nixes, including current Linux
    > kernels, build on that 30-year heritage. That's hard to beat.
    >


    In windows, you have basically 2 types of api's. The typical C/C++
    library type api's, packaged as dll's in windows - these are not
    directly accessible to powershell (well, actually you can use them
    with a little work using the dynamic assembly generation functionality
    of .net - there are lots of examples of doing this on the net, just
    Google "powershell p/invoke"). Though, it is again trivial to create
    a cmdlet that can handle calling these functions if you need them.

    But, there is another class of api's that utilize com, that are
    directly and easily callable from powershell. These cover things like
    the windows task scheduler, bits, cd/dvd burning, media player,
    sending faxes, and manipulating zip archives. This isn't even
    counting automation interface provided by such applications as
    Microsoft Office. Seriously, if you can write a wsh script to automate
    it, you can use it from powershell.

    Not to mention the thousands of classes and objects available in
    the .NET class libraries.

    And if you want some of the Linux tools, well you can always install
    cygwin and call those tools from powershell.

    >
    >
    > >> Seeing as that you know a bit more of it, how does it stack up in
    > >> interaction with the rest of the system?

    >
    > > I don't know that I know more of it. *Eric hasn't posted a lot of
    > > code. *I've played with it, and I use it for tasks occasionally - but,
    > > I'm far from an expert.

    >
    > Yes, but as opposed to Erik, I actually believe you when you say
    > you've used it. Compared to anyone else in this thread, that makes you
    > an expert.
    >
    > > But, I'll say this... *As I mentioned above, if windows provides a COM
    > > interface or a command line tool is present, then you can most likely
    > > use it from powershell. *If there is no interface or utility for a
    > > given operation, it's fairly trivial to write a commandlet to handle
    > > the job. *Powershell is designed to be extensible.

    >
    > As I said to Erik, big *If*. Unix tools, if they are meant to be
    > interfaced, use a simple bytestream, which is an API almost anything
    > on a *nix box can handle.
    >


    I'm not sure how you think that makes things better? Windows provides
    tons of automation interfaces via com - they have for years. None of
    those interfaces have to be changed to be used from powershell,
    because it already understands those automation interfaces (com).

    I would hazard to guess that there are very few windows admin tasks
    that can't be handled from powershell.

    By the way, I agree that in the past MS has not put enough emphasis on
    the command line admin of windows - though that began to change with
    XP and latter. They started providing a lot more command line
    oriented tools, powershell is just a furthering of that new
    philosophy...

    Thinking about it, there is one area that I think bash and other unix
    shell's are better... And that is the ability to create background
    tasks and remote invocation. PowerShell v1 can't do those things
    (well, it can remotely execute wmi objects - but that's a feature of
    wmi not powershell)- though, it is being added in v2 which is supposed
    to ship with Windows 7 (default command shell actually).

    --
    Tom Shelton

  17. Re: Windows PowerShell vs. bash examples

    On Nov 6, 3:01*pm, JEDIDIAH wrote:
    > On 2008-11-06, Tom Shelton wrote:
    >
    >
    >
    > > On Nov 6, 10:54*am, JEDIDIAH wrote:
    > >> On 2008-11-06, Tom Shelton wrote:

    >
    > >> > On Nov 6, 1:49*am, Terry Porter wrote:
    > >> >> On Wed, 05 Nov 2008 08:43:39 -0800, Tom Shelton wrote:
    > >> >> > On Nov 5, 5:57*am, Chris Ahlstrom wrote:
    > >> >> >> After takin' a swig o' grog, Kelsey Bjarnason belched out
    > >> >> >> > tar cvzf - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata..tar.gz"

    >
    > >> >> >> I'm wondering if you can build self-installing compressed archives
    > >> >> >> using only Powershell and command-line commands.

    >
    > >> >> > Out of the box, probably not.

    >
    > >> >> There ya go folks, the debate is over. Kelsey has shown that the old
    > >> >> Linux shell is still far superior to Eriks "PowerShill"

    >
    > >> > So tell me, Terry - how do you do it in bash? *Wait, you don't - bash
    > >> > relies on external tools to do those things. *Bash is a way to glue a
    > >> > bunch of things together, as is Powershell. *The problem here is not
    > >> > so much bash vs powershell, but the availability of tools. *And noone
    > >> > is claiming that windows comes with more commandline tools then Linux
    > >> > - it doesn't.

    >
    > >> * * That is a fact that should not be ignored just to make PowerShell
    > >> appear to be something that it is not. It should be no surprise that
    > >> once again NT suffers for not being Unix. The idea of stringing
    > >> together Win32 style system hooks doesn't seem to be nearly as nifty
    > >> as that same idea in Unix.

    >
    > >> * * It's more like doing posix C calls from within bash.

    >
    > > Who said anything about stringing together win32 hooks? *If you
    > > install those tools on windows (ssh, tar, etc) on windows (cygwin,
    > > maybe sfu), then you can do the exact same thing.

    >
    > > Or are you thinking that you can not execute command line applciations
    > > in powershell? *I think there are some very fundamental
    > > misunderstandings about what powershell is and isn't.

    >
    > * * If it's not there, you can't call it.
    >


    And that differs from bash how? If it's not there you can't call it.

    The difference in windows is that just because there is no command
    line tool, doesn't mean you can't call it. There are tons of
    automation interfaces directly callable from powershell, that have no
    command line utilities - for instances, sending a fax or burning a cd.

    > * * If we have a wrongful idea of powershell, it's entirely due to a
    > poor sales effort.


    It doesn't matter what is said. You apparently have no experience
    with windows automation and you have an automatically biased view of
    anything MS. You hated powershell without knowing anything about it.

    --
    Tom Shelton

  18. Re: Windows PowerShell vs. bash examples

    On Thu, 06 Nov 2008 15:11:39 +0100, "Steve Townsend" wrote:


    >>>
    >>>> Hadron? You have at least twice today spouted nonsense and hope not
    >>>> to be called on it. I was trying to help you clearly fancy yourself
    >>>> as some kind of luminary in this group. Try this rubbish in real
    >>>> linux groups and you will find far ruder people than me.
    >>>
    >>>
    >>> You're obviously new here on COLA, perhaps even new to Linux, judging
    >>> from your total lack of respect to an established Linux advocate like
    >>> Chris.

    >
    > Established or not, if he talks nonsense about things he knows nothing
    > about then expect some response.


    "Some response" and "your response " are two different things.

    >
    >
    >>> How long have you been reading COLA ?

    >
    > In and out for a while.


    Ok, don't answer the question. It's my opinion you are a newly hatched
    Wintroll.

    And you haven't read COLA for the obligatory 3 months yet, judging by
    your ignorance.



    If you're not a Wintroll, you can prove it quite easily doing the
    following.

    1) Apologise to Chris, then see 2) below.

    2) COLA is READ ONLY for you for 3 months, if you just *can't* wait three
    months to post again, then you must wait *six months*.

    3) When you next post here (after 3 months), advocate Linux and do not
    attack long term Linux Advocates. Feel free to debate with them however.

    If you continue to post, you're a Wintroll or a moron, and deserve any
    response you get.

    Here you have to EARN credibility and PROVE who you are FIRST, and no
    amount of whining and insulting will achieve anything.

    Cya in 3 months!



    Ok, the Wintrolls may now queue up to support "Steve Townsend" and rant
    about how right he is and how unfairly he has been treated etc .....



    --
    Linux full time, on the desktop, since August 1997

  19. Re: Windows PowerShell vs. bash examples

    On Thu, 06 Nov 2008 06:32:05 -0500, Ezekiel wrote:



    > One example proves nothing and establishes nothing as "far superior" to
    > anything. Only a fool would believe otherwise.



    One example is all it takes to disprove your buddy Erik the Wintrolls
    claim regarding the superiority of the Windows "Powershell"




    --
    Linux full time, on the desktop, since August 1997

  20. Re: Windows PowerShell vs. bash examples

    In article <86abccbkiz.fsf@gareth.avalon.lan>,
    Mart van de Wege wrote:
    > >> Can you, say, write a Powershell script as an event handler to run on
    > >> hardware changes? Like, e.g., changing the processor powersaving mode
    > >> on disconnecting the AC on a laptop?

    > >
    > > Yes, via WMI objects.
    > >
    > > However, there is little reason to have to do that particular task, since
    > > Windows itself can be configured to do that.

    >
    > In other words, Windows can't do it, so it is useless.
    >
    > Sour grapes.


    What part of "Yes, via WMI objects" did you take to mean "Windows can't
    do it"?

    --
    --Tim Smith

+ Reply to Thread
Page 5 of 11 FirstFirst ... 3 4 5 6 7 ... LastLast