Windows PowerShell vs. bash examples - Linux

This is a discussion on Windows PowerShell vs. bash examples - Linux ; [snips] On Mon, 10 Nov 2008 17:34:01 -0800, Tom Shelton wrote: > function Prompt > { > $host.ui.RawUI.WindowTitle = $(get-location) write-host > ($CurrentUser.Name) -nonewline -foregroundcolor Green " $ " > } Hmm. host.ui.RawUI.WindowTitle. Kinda looks like one of those weird ...

+ Reply to Thread
Page 11 of 11 FirstFirst ... 9 10 11
Results 201 to 217 of 217

Thread: Windows PowerShell vs. bash examples

  1. Re: Windows PowerShell vs. bash examples

    [snips]

    On Mon, 10 Nov 2008 17:34:01 -0800, Tom Shelton wrote:

    > function Prompt
    > {
    > $host.ui.RawUI.WindowTitle = $(get-location) write-host
    > ($CurrentUser.Name) -nonewline -foregroundcolor Green " $ "
    > }


    Hmm. host.ui.RawUI.WindowTitle. Kinda looks like one of those weird
    framework-related things. Wonder when you guys are going to show us
    whatever it is that makes PS so great, instead of this endless circle-
    jerk about how wonderful .NET is.

    Here's a hint: .NET is usable in a whole mess of languages. So is COM.
    To show off PS requires showing us what *PS* can do, not showing us what
    we can *already* do with existing tools.

    30 years late and lame in three legs.


  2. Re: Windows PowerShell vs. bash examples

    On Tue, 11 Nov 2008 09:29:30 -0800, Kelsey Bjarnason wrote:

    > [snips]
    >
    > On Mon, 10 Nov 2008 17:34:01 -0800, Tom Shelton wrote:
    >
    >> function Prompt
    >> {
    >> $host.ui.RawUI.WindowTitle = $(get-location) write-host
    >> ($CurrentUser.Name) -nonewline -foregroundcolor Green " $ "
    >> }

    >
    > Hmm. host.ui.RawUI.WindowTitle. Kinda looks like one of those weird
    > framework-related things. Wonder when you guys are going to show us
    > whatever it is that makes PS so great, instead of this endless circle-
    > jerk about how wonderful .NET is.


    host.ui.RawUI.WindowTitle is a PowerShell environment variable (note the $
    proceeding it). Everything in PowerShell is object oriented, including
    environment variables.

    But that's really beside the point, since your whinging about .net is
    pointless. PowerShell *IS* .net. It's an interactive shell written in
    ..net and exposes .net functionality interactively or via batch script.

    > Here's a hint: .NET is usable in a whole mess of languages. So is COM.
    > To show off PS requires showing us what *PS* can do, not showing us what
    > we can *already* do with existing tools.


    Sure, .net is usable in a whole mess of languages, but not interactively,
    and not via scripting (.net is normally only accessible via compiled
    lanugages).

    > 30 years late and lame in three legs.


    Your problem is that you only have a unix mentality, and you can't seem to
    grasp the concept that an objet oriented shell not only provides a great
    deal more power, but flexibility too.

    The question is not what can and can't be done. Naturally, if you have the
    right toolset, you can do whatever you want in either system. The question
    is how easy the shell is to makes it.

  3. Re: Windows PowerShell vs. bash examples

    After takin' a swig o' grog, Erik Funkenbusch belched out
    this bit o' wisdom:

    > Your problem is that you only have a unix mentality, and you can't seem to
    > grasp the concept that an objet oriented shell not only provides a great
    > deal more power, but flexibility too.
    >
    > The question is not what can and can't be done. Naturally, if you have the
    > right toolset, you can do whatever you want in either system. The question
    > is how easy the shell is to makes it.


    Python time!

    --
    Real Users are afraid they'll break the machine -- but they're never
    afraid to break your face.

  4. Re: Windows PowerShell vs. bash examples

    On 2008-11-11, Chris Ahlstrom wrote:
    > After takin' a swig o' grog, Erik Funkenbusch belched out
    > this bit o' wisdom:
    >
    >> Your problem is that you only have a unix mentality, and you can't seem to
    >> grasp the concept that an objet oriented shell not only provides a great
    >> deal more power, but flexibility too.
    >>
    >> The question is not what can and can't be done. Naturally, if you have the
    >> right toolset, you can do whatever you want in either system. The question
    >> is how easy the shell is to makes it.

    >
    > Python time!


    Some of the admin GUIs in the earliest Redhats were Python.

    --
    Linux: because everyone should get to drink the beer of their |||
    choice and not merely be limited to pretensious imports or hard cider. / | \

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

  5. Re: Windows PowerShell vs. bash examples

    On Nov 11, 10:29*am, Kelsey Bjarnason wrote:
    > [snips]
    >
    > On Mon, 10 Nov 2008 17:34:01 -0800, Tom Shelton wrote:
    > > function Prompt
    > > {
    > > * *$host.ui.RawUI.WindowTitle = $(get-location) write-host
    > > * *($CurrentUser.Name) -nonewline -foregroundcolor Green " $ "
    > > }

    >
    > Hmm. *host.ui.RawUI.WindowTitle. *Kinda looks like one of those weird
    > framework-related things. *Wonder when you guys are going to show us
    > whatever it is that makes PS so great, instead of this endless circle-
    > jerk about how wonderful .NET is.
    >
    > Here's a hint: .NET is usable in a whole mess of languages. *So is COM.*
    > To show off PS requires showing us what *PS* can do, not showing us what
    > we can *already* do with existing tools.
    >
    > 30 years late and lame in three legs.


    Basically, what Eric said. You are missing the entire point of the
    whole thing. You seem to have the mentality that the traditional
    shell is the way that things have to be accomplished.

    Tell me, if you had a shell written in python or ruby, wouldn't you
    expect to be able to access ruby or python libraries from the shell?
    I really don't get your arguments. What do you want us to show you?
    You can't separate out .NET from powershell because it is .NET...

    I don't care if you like Powershell or it's syntax. To me the syntax
    of PS is not the important thing - it's the object oriented shell
    paradigm that I find interesting and powerful.

    --
    Tom Shelton

  6. Re: Windows PowerShell vs. bash examples

    On Nov 11, 1:56*pm, Chris Ahlstrom wrote:
    > After takin' a swig o' grog, Erik Funkenbusch belched out
    > * this bit o' wisdom:
    >
    > > Your problem is that you only have a unix mentality, and you can't seemto
    > > grasp the concept that an objet oriented shell not only provides a great
    > > deal more power, but flexibility too.

    >
    > > The question is not what can and can't be done. *Naturally, if you have the
    > > right toolset, you can do whatever you want in either system. *The question
    > > is how easy the shell is to makes it.

    >
    > Python time!
    >


    Sure, write an object oriented shell in python Might be fun...

    --
    Tom Shelton

  7. Re: Windows PowerShell vs. bash examples

    On Nov 11, 1:56*pm, Chris Ahlstrom wrote:
    > After takin' a swig o' grog, Erik Funkenbusch belched out
    > * this bit o' wisdom:
    >
    > > Your problem is that you only have a unix mentality, and you can't seemto
    > > grasp the concept that an objet oriented shell not only provides a great
    > > deal more power, but flexibility too.

    >
    > > The question is not what can and can't be done. *Naturally, if you have the
    > > right toolset, you can do whatever you want in either system. *The question
    > > is how easy the shell is to makes it.

    >
    > Python time!
    >
    > --
    > Real Users are afraid they'll break the machine -- but they're never
    > afraid to break your face.


    Actually, a quick Google search revealed hotwire - a python based
    object oriented shell, heavily influenced by powershell

    http://arstechnica.com/journals/linu...e-with-hotwire

    "Hotwire is developed with Python and GTK, and doesn't provide a new
    shell scripting language of its own. Heavily inspired by Microsoft
    Powershell, the underlying infrastructure of Hotwire is based on the
    principle of object pipelines. Instead of piping static text from one
    command to another, Hotwire transmits Python object instances.
    Hotwire's object-oriented underpinnings make it possible to perform
    filtering on object properties and display command output in graphical
    tables with titled columns."

    So, there you have it. Apparently, the FOSS community isn't totally
    uninspired by the concept of an object oriented shell.

    --
    Tom Shelton

  8. Re: Windows PowerShell vs. bash examples

    After takin' a swig o' grog, Tom Shelton belched out
    this bit o' wisdom:

    > On Nov 11, 1:56*pm, Chris Ahlstrom wrote:
    >> After takin' a swig o' grog, Erik Funkenbusch belched out
    >> * this bit o' wisdom:
    >>
    >> > Your problem is that you only have a unix mentality, and you can't seem to
    >> > grasp the concept that an objet oriented shell not only provides a great
    >> > deal more power, but flexibility too.

    >>
    >> > The question is not what can and can't be done. *Naturally, if you have the
    >> > right toolset, you can do whatever you want in either system. *The question
    >> > is how easy the shell is to makes it.

    >>
    >> Python time!

    >
    > Sure, write an object oriented shell in python Might be fun...


    Huh? Python already has an object-oriented shell.

    And you can run its scripts from bash.

    --
    Who loves not wisely but too well
    Will look on Helen's face in hell,
    But he whose love is thin and wise
    Will view John Knox in Paradise.
    -- Dorothy Parker

  9. Re: Windows PowerShell vs. bash examples

    After takin' a swig o' grog, Tom Shelton belched out
    this bit o' wisdom:

    > Actually, a quick Google search revealed hotwire - a python based
    > object oriented shell, heavily influenced by powershell
    >
    > http://arstechnica.com/journals/linu...e-with-hotwire
    >
    > "Hotwire is developed with Python and GTK, and doesn't provide a new
    > shell scripting language of its own. Heavily inspired by Microsoft
    > Powershell, the underlying infrastructure of Hotwire is based on the
    > principle of object pipelines. Instead of piping static text from one
    > command to another, Hotwire transmits Python object instances.
    > Hotwire's object-oriented underpinnings make it possible to perform
    > filtering on object properties and display command output in graphical
    > tables with titled columns."
    >
    > So, there you have it. Apparently, the FOSS community isn't totally
    > uninspired by the concept of an object oriented shell.


    Shame on you for coming up with "Googled" knowledge! Hadron will assuredly
    upbraid you for your temerity! Ha!

    http://hotwire-shell.org/

    How is Hotwire better than Windows PowerShell?

    Hotwire shares a conceptual heritage with PowerShell's object-oriented
    underpinnings. However, Hotwire makes a number of different design
    decisions, and the result is a very different program. For a start,
    Hotwire was designed for a rich, interactive graphical interface. While
    third party PowerShell environments exist, the result isn't the same as
    if the entire system was designed for it from the start.

    Another design choice is that the Hotwire project made the decision very
    early not to attempt to create a full new scripting language. Hotwire
    does have a small Unix-inspired pipeline syntax, but a major goal of the
    project is to make it easy for users to leverage well-known existing
    programming languages such as Python and Ruby - and (where available)
    Unix shell script.

    Finally, Hotwire has a much more day-to-day system interaction feel to it
    than PowerShell does. For example, Hotwire is fanatical about saving your
    history, and making it easy to find frequently used commands and
    directories again. Hotwire integrates with the desktop - its builtin rm
    moves files to the Trash. And going further, on Unix Hotwire integrates
    closely with other systems programming tools like OpenSSH; the ssh
    builtin allows completion from known_hosts, and it is a longer-term goal
    for Hotwire to provide the best possible SSH experience.

    You can also use python's own interactive shell. There's also an enhanced
    version, for interactive parallel computing:

    http://ipython.scipy.org/moin/

    --
    America may be unique in being a country which has leapt from barbarism
    to decadence without touching civilization.
    -- John O'Hara

  10. Re: Windows PowerShell vs. bash examples

    On 2008-11-11, Tom Shelton wrote:
    > On Nov 11, 10:29*am, Kelsey Bjarnason wrote:
    >> [snips]
    >>
    >> On Mon, 10 Nov 2008 17:34:01 -0800, Tom Shelton wrote:
    >> > function Prompt
    >> > {
    >> > * *$host.ui.RawUI.WindowTitle = $(get-location) write-host
    >> > * *($CurrentUser.Name) -nonewline -foregroundcolor Green " $ "
    >> > }

    >>
    >> Hmm. *host.ui.RawUI.WindowTitle. *Kinda looks like one of those weird
    >> framework-related things. *Wonder when you guys are going to show us
    >> whatever it is that makes PS so great, instead of this endless circle-
    >> jerk about how wonderful .NET is.
    >>
    >> Here's a hint: .NET is usable in a whole mess of languages. *So is COM. *
    >> To show off PS requires showing us what *PS* can do, not showing us what
    >> we can *already* do with existing tools.
    >>
    >> 30 years late and lame in three legs.

    >
    > Basically, what Eric said. You are missing the entire point of the
    > whole thing. You seem to have the mentality that the traditional


    What? A "shell" language for .NET?

    Who cares? That's not even that useful if I were still a Windows
    user. Who wants to be a C++ programmer just to write batch files.
    That's the height of stupidity.

    > shell is the way that things have to be accomplished.
    >
    > Tell me, if you had a shell written in python or ruby, wouldn't you
    > expect to be able to access ruby or python libraries from the shell?


    Yeah... except these are things that I could reasonably expect to
    be platform independent or at least ported with the toolkit when it
    moves to a new platform.

    Powershell for all of it's "virtue" is ultimately just another
    mechanism to reinforce Microsoft control and prevent you from using
    a better product (should you decide that something is better).

    > I really don't get your arguments. What do you want us to show you?
    > You can't separate out .NET from powershell because it is .NET...
    >
    > I don't care if you like Powershell or it's syntax. To me the syntax
    > of PS is not the important thing - it's the object oriented shell
    > paradigm that I find interesting and powerful.
    >
    > --
    > Tom Shelton



    --


    The average IT manager is a less effective mentor than a
    Spongebob Squarepants cartoon.


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

  11. Re: Windows PowerShell vs. bash examples

    On Nov 11, 3:16*pm, Chris Ahlstrom wrote:
    > After takin' a swig o' grog, Tom Shelton belched out
    > * this bit o' wisdom:
    >
    > > On Nov 11, 1:56*pm, Chris Ahlstrom wrote:
    > >> After takin' a swig o' grog, Erik Funkenbusch belched out
    > >> * this bit o' wisdom:

    >
    > >> > Your problem is that you only have a unix mentality, and you can't seem to
    > >> > grasp the concept that an objet oriented shell not only provides a great
    > >> > deal more power, but flexibility too.

    >
    > >> > The question is not what can and can't be done. *Naturally, if youhave the
    > >> > right toolset, you can do whatever you want in either system. *Thequestion
    > >> > is how easy the shell is to makes it.

    >
    > >> Python time!

    >
    > > Sure, write an object oriented shell in python *Might be fun...

    >
    > Huh? *Python already has an object-oriented shell.
    >


    You can definately enter the interpreter in interactive mode - but, is
    that really a shell? Not trying to argue, just thinking about that

    --
    Tom Shelton

  12. Re: Windows PowerShell vs. bash examples

    On Nov 11, 4:03*pm, JEDIDIAH wrote:
    > On 2008-11-11, Tom Shelton wrote:
    >
    >
    >
    > > On Nov 11, 10:29*am, Kelsey Bjarnason wrote:
    > >> [snips]

    >
    > >> On Mon, 10 Nov 2008 17:34:01 -0800, Tom Shelton wrote:
    > >> > function Prompt
    > >> > {
    > >> > * *$host.ui.RawUI.WindowTitle = $(get-location) write-host
    > >> > * *($CurrentUser.Name) -nonewline -foregroundcolor Green " $ "
    > >> > }

    >
    > >> Hmm. *host.ui.RawUI.WindowTitle. *Kinda looks like one of those weird
    > >> framework-related things. *Wonder when you guys are going to show us
    > >> whatever it is that makes PS so great, instead of this endless circle-
    > >> jerk about how wonderful .NET is.

    >
    > >> Here's a hint: .NET is usable in a whole mess of languages. *So is COM. *
    > >> To show off PS requires showing us what *PS* can do, not showing us what
    > >> we can *already* do with existing tools.

    >
    > >> 30 years late and lame in three legs.

    >
    > > Basically, what Eric said. *You are missing the entire point of the
    > > whole thing. *You seem to have the mentality that the traditional

    >
    > * * What? A "shell" language for .NET?
    >
    > * * Who cares? That's not even that useful if I were still a Windows
    > user. Who wants to be a C++ programmer just to write batch files.
    > That's the height of stupidity.
    >


    No, but that comment is. Seriously... It's a shell scripting
    environment, with a C#/Perlesque feel. I'm not sure where you come up
    with this stuff.

    > > shell is the way that things have to be accomplished.

    >
    > > Tell me, if you had a shell written in python or ruby, wouldn't you
    > > expect to be able to access ruby or python libraries from the shell?

    >
    > * * *Yeah... except these are things that I could reasonably expectto
    > be platform independent or at least ported with the toolkit when it
    > moves to a new platform.
    >
    > * * *Powershell for all of it's "virtue" is ultimately just another
    > mechanism to reinforce Microsoft control and prevent you from using
    > a better product (should you decide that something is better).
    >


    And what makes you think that it can't be ported to Linux? Except for
    maybe the wmi stuff (which powershell does have some special support
    for) and the ability to call COM objects, there is no reason that PS
    would nor work on Mono. Oh, wait - it already is being ported as
    pash.

    Still, you are missing the point - I'm not trying to get you to use
    powershell. Again, the point is the power and flexibility that comes
    with a shell environment like powershell. But, this is just
    degenerating into a it's from MS so it's crap discussion, which is
    entirely pointless.

    --
    Tom Shelton

  13. Re: Windows PowerShell vs. bash examples

    [snips]

    On Tue, 11 Nov 2008 15:29:11 -0800, Tom Shelton wrote:

    > powershell. Again, the point is the power and flexibility that comes
    > with a shell environment like powershell.


    Sorry, what power?

    We already have cli tools, scripting languages and the like which can be
    chained into arbitrarily complex - and arbitrarily powerful - functional
    units, complete with entire frameworks, object-oriented coding if we want
    it, blah, blah, blah - all the stuff PS supposedly gives us.

    The key difference seems to be in design: our stuff is modular enough
    that you bring in what you need - much of which will already exist on the
    machine - where PS/.NET's design is "if you need a 78K sort tool, bring
    in 600MB of other crap." Crap which, as I understand it, you can't even
    modify.

    Why anyone would see this as flexibility, power, or anything but a poor
    joke in even poorer taste isn't clear.

    Then again, we've had decent CLI tools for decades; Windows admins
    *still* don't have them, so maybe it's really nothing more than "Well,
    it's better than what we have now". Which may be true, but a better
    grade of dung still can't compare to steak.


  14. Re: Windows PowerShell vs. bash examples

    On Tue, 11 Nov 2008 15:57:56 -0800, Kelsey Bjarnason wrote:

    > [snips]
    >
    > On Tue, 11 Nov 2008 15:29:11 -0800, Tom Shelton wrote:
    >
    >> powershell. Again, the point is the power and flexibility that comes
    >> with a shell environment like powershell.

    >
    > Sorry, what power?
    >
    > We already have cli tools, scripting languages and the like which can be
    > chained into arbitrarily complex - and arbitrarily powerful - functional
    > units, complete with entire frameworks, object-oriented coding if we want
    > it, blah, blah, blah - all the stuff PS supposedly gives us.


    You're like a carpenter claiming he's just as productive with his hammer
    and nail as the guy with a nailgun. You can do all the same thing. Who
    gets the job done faster?

    > The key difference seems to be in design: our stuff is modular enough
    > that you bring in what you need - much of which will already exist on the
    > machine - where PS/.NET's design is "if you need a 78K sort tool, bring
    > in 600MB of other crap." Crap which, as I understand it, you can't even
    > modify.


    Oh, so you are constantly modifying grep, tail, cut, sed and awk huh? I
    don't believe you've ever modifed any of those tools.

    When are you going to get that the majority of people don't care if
    something takes a few more k or even megs of memory? They don't. I mean,
    that nail gun needs an expensive air compressor or electrical feed. So
    obviously it's more crap than a hammer and nails, right?

    You pay for progress and power in resources. Come out of the stone age.

    The real key difference is that you *can* do everything in PS the same way
    you'd do it in bash. Exactly the same way, in fact, because you can use
    all the exact same tools. But doing that is stupid because you lose the
    power and flexibility of the environment.

    It's like getting out and pushing your ferarri because you don't want to
    waste gas.

    > Why anyone would see this as flexibility, power, or anything but a poor
    > joke in even poorer taste isn't clear.


    What a sad life you must live if you are offended because someone has a
    different opinion than yours.

    > Then again, we've had decent CLI tools for decades; Windows admins
    > *still* don't have them, so maybe it's really nothing more than "Well,
    > it's better than what we have now". Which may be true, but a better
    > grade of dung still can't compare to steak.


    You keep saying that, yet since I can do *EVERYTHING*, and I do mean
    everything that bash can do in PS, how do I not have decent tools?

  15. Re: Windows PowerShell vs. bash examples

    After takin' a swig o' grog, Tom Shelton belched out
    this bit o' wisdom:

    > On Nov 11, 3:16*pm, Chris Ahlstrom wrote:
    >>
    >> > Sure, write an object oriented shell in python *Might be fun...

    >>
    >> Huh? *Python already has an object-oriented shell.

    >
    > You can definately enter the interpreter in interactive mode - but, is
    > that really a shell? Not trying to argue, just thinking about that


    The book "Programming Python" calls it a shell. It acts a lot like a shell.
    Except that you can also import modules and call member functions of the
    objects thus imported.

    >>> import os
    >>> os.getcwd()

    '/home/linonut'
    >>> os.environ['LC_ALL']

    'en_US'
    >>> help(os)


    The main immediate difference is that you don't have bare access to external
    executables:

    >>> os.system('ls')


    I've been doing a little work with a wiki (moin moin), and it uses python
    scripts as its configuration files.

    Anyway, if you want cross-platform scripting and even some applications,
    python seems like a good way to go.

    --
    Remember the good old days, when CPU was singular?

  16. Re: Windows PowerShell vs. bash examples

    After takin' a swig o' grog, Kelsey Bjarnason belched out
    this bit o' wisdom:

    > The question then becomes, if that's the only "benefit" of PS, who the
    > hell wants it?


    Well, were I a Windows sysadmin or power user (I'm not, I just write
    programs for it), I would welcome PowerShell as a great improvement over the
    latest version of CMD.exe's batch files.

    --
    Weiler's Law:
    Nothing is impossible for the man who doesn't have to do it himself.

  17. Re: Windows PowerShell vs. bash examples

    On Nov 11, 5:42*pm, Chris Ahlstrom wrote:
    > After takin' a swig o' grog, Tom Shelton belched out
    > * this bit o' wisdom:
    >
    > > On Nov 11, 3:16*pm, Chris Ahlstrom wrote:

    >
    > >> > Sure, write an object oriented shell in python *Might be fun...

    >
    > >> Huh? *Python already has an object-oriented shell.

    >
    > > You can definately enter the interpreter in interactive mode - but, is
    > > that really a shell? *Not trying to argue, just thinking about that

    >
    > The book "Programming Python" calls it a shell. *It acts a lot like a shell.
    > Except that you can also import modules and call member functions of the
    > objects thus imported.
    >
    > * *>>> import os
    > * *>>> os.getcwd()
    > * *'/home/linonut'
    > * *>>> os.environ['LC_ALL']
    > * *'en_US'
    > * *>>> help(os)
    >


    You can do this in powershell as well - with external .net libraries -
    though, the syntax is a little ugly

    [void][reflection.assembly]::loadwithpartialname("system.net.sockets")
    [net.sockets.socket] | gm

    That will give you a list of all of the availabe methods on the socket
    type.

    > The main immediate difference is that you don't have bare access to external
    > executables:
    >
    > * *>>> os.system('ls')
    >


    I think that might be the main difference - what about the
    environment? In ps you have access to all of the system environment
    variables via the $env object:

    $envath

    prints the current value of the path environment variable.

    > I've been doing a little work with a wiki (moin moin), and it uses python
    > scripts as its configuration files.
    >
    > Anyway, if you want cross-platform scripting and even some applications,
    > python seems like a good way to go.


    Oh, definately. I used to use Perl that way as well.

    --
    Tom Shelton

+ Reply to Thread
Page 11 of 11 FirstFirst ... 9 10 11