Windows PowerShell vs. bash examples - Linux

This is a discussion on Windows PowerShell vs. bash examples - Linux ; After takin' a swig o' grog, Tom Shelton belched out this bit o' wisdom: > On Nov 5, 10:01?am, Chris Ahlstrom wrote: >> After takin' a swig o' grog, Tom Shelton belched out >> ? this bit o' wisdom: >> ...

+ Reply to Thread
Page 3 of 11 FirstFirst 1 2 3 4 5 ... LastLast
Results 41 to 60 of 217

Thread: Windows PowerShell vs. bash examples

  1. Re: Windows PowerShell vs. bash examples

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

    > On Nov 5, 10:01?am, Chris Ahlstrom wrote:
    >> After takin' a swig o' grog, Tom Shelton belched out
    >> ? this bit o' wisdom:
    >>
    >> > On Nov 5, 5:57?am, Chris Ahlstrom wrote:

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

    >>
    >> > Out of the box, probably not. ?But, it would be fairly trivial to
    >> > write a function or commandlet that used sharpziplib to compress/
    >> > decompress zip archives.

    >>
    >> I don't mind if the script uses an external app like tar. ?I was wondering
    >> if you can create a package structured like this:
    >>
    >> #!/bin/sh
    >> export TMPDIR=`mktemp -d /tmp/LinuxBuildInstaller.XXXXXX`
    >> ARCHIVE=`awk '/^_____ARCHIVE__FOLLOWS_____/ { print NR + 1 ; exit 0 ; }' $0`
    >> tail -n+$ARCHIVE $0 | tar xzv -C $TMPDIR
    >> CURRENT_DIR=`pwd`
    >> cd $TMPDIR
    >> ./LinuxBuildRawInstaller
    >> _____ARCHIVE__FOLLOWS_____
    >> ^_<8b>^H^@? ????H^@^C??\ t ?.... (binary data for the tar file)

    >
    > Assuming you have an archiving tool, I don't see why not.


    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.)


  2. Re: Windows PowerShell vs. bash examples

    On Nov 5, 11:54*am, JEDIDIAH wrote:
    > On 2008-11-05, Tom Shelton wrote:
    >
    >
    >
    > > On Nov 5, 12:02*am, Terry Porter wrote:
    > >> On Mon, 03 Nov 2008 21:31:08 -0800, Tom Shelton wrote:
    > >> > On Nov 3, 7:19*pm, Terry Porter wrote:
    > >> >> [crossposts snipped]

    >
    > >> >> On Sun, 02 Nov 2008 22:37:57 -0600, Ignoramus22113 wrote:

    > [deletia]
    > >> In the case of his 'powershell' example, it didn't look any easier than
    > >> plain old bash, certainly not the "leap" in technology Erik was raving
    > >> about.

    >
    > >> I'm not surprised that the reality is a lot less than the claims when it
    > >> comes to Erik.

    >
    > >> Colour me underwhelmed.

    >
    > > The leap in technology is not the relative ease of use. *Somethings in
    > > powershell are harder, some are easier.

    >
    > > The things that makes powershell powerfull is it's object oriented
    > > nature. *If you want a fair evaluation of powershell vs bash, take a
    > > look at this article from Linux magazine:

    >
    > ...which seems to be a great thing for software engineering and a
    > pisspoor thing for scripting.
    >
    > * *Take a simple problem and make it needlessly complex.
    >
    > * *Every powershell example I've ever seen has fit this description.
    >
    > [deletia]
    >
    > * *The whole "object oriented" bit just seems to be a buzzword bingo.


    I dissagree. Working with objects makes some things simpler. I have
    actual properties, I don't have to resort to utilities such as cut to
    extract fields etc. Here are a couple of common type powershell
    commands:

    # list the 3 process with the largest working set
    ps | sort ws -des | select -f 3

    # list all processes with a working set over 20MB
    ps | where {$_.ws -gt 20MB}

    Yes, things can get more complex - especially if your trying to do
    some formating other then the default (that's actually most of the
    code I posted in the wmi example).

    I think if you worked with it a bit, and could get over the whole -
    "If it's from MS it must suck" mentality - I think you would find that
    streaming objects through a pipeline is a pretty powerful concept.

    --
    Tom Shelton


  3. Re: Windows PowerShell vs. bash examples

    On Nov 5, 12:33*pm, Chris Ahlstrom wrote:
    > After takin' a swig o' grog, Tom Shelton belched out
    > * this bit o' wisdom:
    >
    >
    >
    > > On Nov 5, 9:55*am, Chris Ahlstrom wrote:
    > >> After takin' a swig o' grog, Tom Shelton belched out

    >
    > >> > $s = [wmisearcher] 'select * from win32_operatingsystem'
    > >> > $s.get() | select
    > >> > @{Name="Computer";Expression={$env:computername}},@{Name = "OS
    > >> > Version";Expression = {$_.Version}},@{Name = "Service
    > >> > Pack";Expression={[string]::Format("{0}.{1}",
    > >> > $_.ServicePackMajorVersion, $_.ServicePackMinorVersion)}} | fl

    >
    > >> Python:

    >
    > >>http://www.thescriptlibrary.com/defa...ion&Title=List Operating System Properties

    >
    > >> import win32com.client
    > >> strComputer = "."
    > >> objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
    > >> objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
    > >> colItems = objSWbemServices.ExecQuery("Select * from Win32_OperatingSystem")
    > >> for objItem in colItems:
    > >> * *print "Service Pack Major Version: ", objItem.ServicePackMajorVersion
    > >> * *print "Service Pack Minor Version: ", objItem.ServicePackMinorVersion

    >
    > > While, thats a nice python example - that isn't the shell. *Nor is it
    > > much different then the vbscript example. My shell script is two lines
    > > - and really could be one

    >
    > Whatever, dude. *You can type that example into the Python *shell*, andrun
    > it from there.
    >
    > And I count six lines in your example, not two.
    >


    word wrap it's two lines on the command prompt - could be one.

    --
    Tom Shelton


  4. Re: Windows PowerShell vs. bash examples

    On Nov 5, 12:35*pm, Chris Ahlstrom wrote:
    > After takin' a swig o' grog, Tom Shelton belched out
    > * this bit o' wisdom:
    >
    >
    >
    > > On Nov 5, 10:01?am, Chris Ahlstrom wrote:
    > >> After takin' a swig o' grog, Tom Shelton belched out
    > >> ? this bit o' wisdom:

    >
    > >> > On Nov 5, 5:57?am, Chris Ahlstrom wrote:

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

    >
    > >> > Out of the box, probably not. ?But, it would be fairly trivial to
    > >> > write a function or commandlet that used sharpziplib to compress/
    > >> > decompress zip archives.

    >
    > >> I don't mind if the script uses an external app like tar. ?I was wondering
    > >> if you can create a package structured like this:

    >
    > >> #!/bin/sh
    > >> export TMPDIR=`mktemp -d /tmp/LinuxBuildInstaller.XXXXXX`
    > >> ARCHIVE=`awk '/^_____ARCHIVE__FOLLOWS_____/ { print NR + 1 ; exit 0 ; }' $0`
    > >> tail -n+$ARCHIVE $0 | tar xzv -C $TMPDIR
    > >> CURRENT_DIR=`pwd`
    > >> cd $TMPDIR
    > >> ./LinuxBuildRawInstaller
    > >> _____ARCHIVE__FOLLOWS_____
    > >> ^_<8b>^H^@? ????H^@^C??\ t ?.... (binary data for the tar file)

    >
    > > Assuming you have an archiving tool, I don't see why not.

    >
    > 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.

    --
    Tom Shelton




  5. Re: Windows PowerShell vs. bash examples

    On Nov 5, 12:31 pm, Tom Shelton wrote:
    > On Nov 5, 12:35 pm, Chris Ahlstrom wrote:
    >
    >
    >
    > > After takin' a swig o' grog, Tom Shelton belched out
    > > this bit o' wisdom:

    >
    > > > On Nov 5, 10:01?am, Chris Ahlstrom wrote:
    > > >> After takin' a swig o' grog, Tom Shelton belched out
    > > >> ? this bit o' wisdom:

    >
    > > >> > On Nov 5, 5:57?am, Chris Ahlstrom wrote:

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

    >
    > > >> > Out of the box, probably not. ?But, it would be fairly trivial to
    > > >> > write a function or commandlet that used sharpziplib to compress/
    > > >> > decompress zip archives.

    >
    > > >> I don't mind if the script uses an external app like tar. ?I was wondering
    > > >> if you can create a package structured like this:

    >
    > > >> #!/bin/sh
    > > >> export TMPDIR=`mktemp -d /tmp/LinuxBuildInstaller.XXXXXX`
    > > >> ARCHIVE=`awk '/^_____ARCHIVE__FOLLOWS_____/ { print NR + 1 ; exit 0 ; }' $0`
    > > >> tail -n+$ARCHIVE $0 | tar xzv -C $TMPDIR
    > > >> CURRENT_DIR=`pwd`
    > > >> cd $TMPDIR
    > > >> ./LinuxBuildRawInstaller
    > > >> _____ARCHIVE__FOLLOWS_____
    > > >> ^_<8b>^H^@? ????H^@^C??\ t ?.... (binary data for the tar file)

    >
    > > > Assuming you have an archiving tool, I don't see why not.

    >
    > > 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.
    >
    > --
    > Tom Shelton


    I'll admit I know very little about Powershell except
    that it's Microsoft's new toy and that it can work either
    with objects or byte streams. I fail to see how it (or
    the tools associated with it) can easily convert byte
    streams to objects, though I don't know what Windows tools
    might be available there anyway.

    Bash doesn't have quite this problem, it punts to the
    tools parsing the bytestream, allowing for any number
    of formats, from a simplified ASCII description to ASN.1
    to Java or JSON.

    Nor is TAR quite available on Windows. One might be able
    to extract CAB files, though I don't know the tool name.
    On Gentoo I have a tool named 'cabextract', and I do
    see a tool named 'makecab.exe' on my copy of Windows.
    I also see 'extract32.exe' and 'wextract.exe'. (I have
    no idea offhand what they do; I'm running Linux and am not
    about to run these under WinE, though they're most likely
    mostly harmless. It's a different problem anyway.)

    The vast majority of self-extracting archives are probably
    modified ZIP files with a built-in unpacker in x86 code.
    I don't know what .MSI looks like but suspect a modified
    CAB format.


  6. Re: Windows PowerShell vs. bash examples

    On Nov 5, 2:11*pm, The Ghost In The Machine
    wrote:
    > On Nov 5, 12:31 pm, Tom Shelton wrote:
    >
    >
    >
    > > On Nov 5, 12:35 pm, Chris Ahlstrom wrote:

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

    >
    > > > > On Nov 5, 10:01?am, Chris Ahlstrom wrote:
    > > > >> After takin' a swig o' grog, Tom Shelton belched out
    > > > >> ? this bit o' wisdom:

    >
    > > > >> > On Nov 5, 5:57?am, Chris Ahlstrom wrote:

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

    >
    > > > >> > Out of the box, probably not. ?But, it would be fairly trivial to
    > > > >> > write a function or commandlet that used sharpziplib to compress/
    > > > >> > decompress zip archives.

    >
    > > > >> I don't mind if the script uses an external app like tar. ?I was wondering
    > > > >> if you can create a package structured like this:

    >
    > > > >> #!/bin/sh
    > > > >> export TMPDIR=`mktemp -d /tmp/LinuxBuildInstaller.XXXXXX`
    > > > >> ARCHIVE=`awk '/^_____ARCHIVE__FOLLOWS_____/ { print NR + 1 ; exit 0 ; }' $0`
    > > > >> tail -n+$ARCHIVE $0 | tar xzv -C $TMPDIR
    > > > >> CURRENT_DIR=`pwd`
    > > > >> cd $TMPDIR
    > > > >> ./LinuxBuildRawInstaller
    > > > >> _____ARCHIVE__FOLLOWS_____
    > > > >> ^_<8b>^H^@? ????H^@^C??\ t ?.... (binary data for the tar file)

    >
    > > > > Assuming you have an archiving tool, I don't see why not.

    >
    > > > 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 untarit.)

    >
    > > 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.

    >
    > > --
    > > Tom Shelton

    >
    > I'll admit I know very little about Powershell except
    > that it's Microsoft's new toy and that it can work either
    > with objects or byte streams. *I fail to see how it (or
    > the tools associated with it) can easily convert byte
    > streams to objects, though I don't know what Windows tools
    > might be available there anyway.
    >


    The problem is embeding it in the script. Not passing around byte
    streams.

    > Bash doesn't have quite this problem, it punts to the
    > tools parsing the bytestream, allowing for any number
    > of formats, from a simplified ASCII description to ASN.1
    > to Java or JSON.
    >


    Not a problem. you have a lot of control over the serialized format
    of any .NET object.

    > Nor is TAR quite available on Windows. *One might be able
    > to extract CAB files, though I don't know the tool name.
    > On Gentoo I have a tool named 'cabextract', and I do
    > see a tool named 'makecab.exe' on my copy of Windows.
    > I also see 'extract32.exe' and 'wextract.exe'. *(I have
    > no idea offhand what they do; I'm running Linux and am not
    > about to run these under WinE, though they're most likely
    > mostly harmless. *It's a different problem anyway.)
    >


    I can use cygwin tar just fine from powershell. Or, I can just create
    a function that uses sharpziplib to use zip instead. Or, as you so
    wisely notice I can use makecab and expand to handle cab files -
    though, I'm not so sure that you can pipe the data into expand

    Still, the problem isn't about passing the data stream, it's about
    embedding it in the script.

    --
    Tom Shelton

  7. Re: Windows PowerShell vs. bash examples

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

    > I think if you worked with it a bit, and could get over the whole -
    > "If it's from MS it must suck" mentality - I think you would find that
    > streaming objects through a pipeline is a pretty powerful concept.


    Well, maybe the "pash" app that Mike linked to would be useful, then.

    Powershell is not, for Linux users.

    I think I'd stick with Python.

    --
    I will honour Christmas in my heart, and try to keep it all the year. I
    will live in the Past, the Present, and the Future. The Spirits of all
    Three shall strive within me. I will not shut out the lessons that they
    teach. Oh, tell me that I may sponge away the writing on this stone!
    -- Charles Dickens

  8. Re: Windows PowerShell vs. bash examples

    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.

    --
    design, v.:
    What you regret not doing later on.

  9. Re: Windows PowerShell vs. bash examples

    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


  10. Re: Windows PowerShell vs. bash examples

    On Tue, 04 Nov 2008 01:46:26 -0800, Tom Shelton wrote:

    > On Nov 3, 11:01*pm, jebblue wrote:
    >> On Mon, 03 Nov 2008 21:31:08 -0800, Tom Shelton wrote:
    >> > His post was pure crap. *None of that was powershell. *Those were old
    >> > vbscripts.

    >>
    >> > Eric already posted a real powershell example... *Do you want more?

    >>
    >> I tried Powershell. Powershell is no BASH. KSH from the mid 90's is
    >> more powerful. BASH actually makes sense ... and is multi-platform.
    >>
    >> --
    >> // This is my opinion.

    >
    > Liar.
    >
    > HTH


    And if you are the real Tom Shelton then you owe me an apology
    for being very rude and hurtful. I stated my opinion, my view.

    --
    // This is my opinion.

  11. Re: Windows PowerShell vs. bash examples

    After takin' a swig o' grog, Steve Townsend belched out
    this bit o' wisdom:

    > Chris Ahlstrom writes:
    >
    >> 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


    What, are you taking over Hadron's assignment of dogging me, trying to catch
    me making errors, and thinking you've done so, because you misconstrue or
    misrepresent what I write?

    Where do I say that size limits are not important in GNU. GNU has a
    philosophy, well documented in their glibc manual: "no arbitrary limits",
    and they hew to it pretty well.

    For example, I believe the command-line size limit in bash is 32K.
    What is it in the DOS shell? 1024? Or worse?

    How about Powershell? What is its command line limit?

    But, in the script we're talking about, it is not a limit on the bash
    command-line we're talking about. You pulled that one out of your Hadronic
    ass.

    It's awk's limits, it's ability to handle binary data of essentially
    unlimited length... except on Windows:

    http://www.mkssoftware.com/docs/man1/awk.1.asp

    Remember to read for comprehension, dude.

    --
    Welcome to the Zoo!

  12. Re: Windows PowerShell vs. bash examples

    On Nov 5, 3:37*pm, Chris Ahlstrom wrote:
    > After takin' a swig o' grog, Tom Shelton belched out
    > * this bit o' wisdom:
    >
    > > I think if you worked with it a bit, and could get over the whole -
    > > "If it's from MS it must suck" mentality - I think you would find that
    > > streaming objects through a pipeline is a pretty powerful concept.

    >
    > Well, maybe the "pash" app that Mike linked to would be useful, then.
    >
    > Powershell is not, for Linux users.
    >


    That's true. At least for now. But since, PowerShell is based
    on .NET, you should be able to port it to Mono

    > I think I'd stick with Python.
    >


    Not a bad choice, if you really need to be cross platform.

    --
    Tom Shelton

  13. Re: Windows PowerShell vs. bash examples

    On Nov 5, 3:39*pm, Chris Ahlstrom wrote:
    > 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.
    >


    I'm in fact going to see what I can do right now It's an
    interesting problem.

    > 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.


    It's not the size of the data, nor the fact that's binary data that I
    see a problem - it's the fact that is actually embedded in the file
    with the script. If it was a file along side the script, it wouldn't
    be an issue at all - but I see what your trying to do, and now I'm
    curious

    --
    Tom Shelton

  14. Re: Windows PowerShell vs. bash examples

    On Nov 5, 6:29*pm, Tom Shelton wrote:
    > On Nov 5, 3:39*pm, Chris Ahlstrom wrote:
    >
    >
    >
    >
    >
    > > 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.

    >
    > I'm in fact going to see what I can do right now *It's an
    > interesting problem.
    >
    > > 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.

    >
    > It's not the size of the data, nor the fact that's binary data that I
    > see a problem - it's the fact that is actually embedded in the file
    > with the script. *If it was a file along side the script, it wouldn't
    > be an issue at all - but I see what your trying to do, and now I'm
    > curious
    >
    > --
    > Tom Shelton- Hide quoted text -
    >
    > - Show quoted text -


    Duh... I just figured it out. put it in a here string base64
    encoded. I do this all the time to put stuff in xml

    --
    Tom Shelton

  15. Re: Windows PowerShell vs. bash examples

    Chris Ahlstrom writes:

    > After takin' a swig o' grog, Steve Townsend belched out
    > this bit o' wisdom:
    >
    >> Chris Ahlstrom writes:
    >>
    >>> 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

    >
    > What, are you taking over Hadron's assignment of dogging me, trying to catch
    > me making errors, and thinking you've done so, because you misconstrue or
    > misrepresent what I write?


    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.

    >
    > Where do I say that size limits are not important in GNU. GNU has a


    Where did I say it was? I was talking about bash. Not Gnu.

    > philosophy, well documented in their glibc manual: "no arbitrary limits",
    > and they hew to it pretty well.
    >
    > For example, I believe the command-line size limit in bash is 32K.
    > What is it in the DOS shell? 1024? Or worse?


    You are blustering. You were wrong. xargs exists for a reason. Read up on
    it when you finish learning what DirectX is versus X-Windows. Then come
    back and preach but until then I suggest you don't venture forth on
    subjects you clearly now little about.

  16. Re: Windows PowerShell vs. bash examples

    On Nov 5, 12:35*pm, Chris Ahlstrom wrote:
    > After takin' a swig o' grog, Tom Shelton belched out
    > * this bit o' wisdom:
    >
    >
    >
    >
    >
    > > On Nov 5, 10:01?am, Chris Ahlstrom wrote:
    > >> After takin' a swig o' grog, Tom Shelton belched out
    > >> ? this bit o' wisdom:

    >
    > >> > On Nov 5, 5:57?am, Chris Ahlstrom wrote:

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

    >
    > >> > Out of the box, probably not. ?But, it would be fairly trivial to
    > >> > write a function or commandlet that used sharpziplib to compress/
    > >> > decompress zip archives.

    >
    > >> I don't mind if the script uses an external app like tar. ?I was wondering
    > >> if you can create a package structured like this:

    >
    > >> #!/bin/sh
    > >> export TMPDIR=`mktemp -d /tmp/LinuxBuildInstaller.XXXXXX`
    > >> ARCHIVE=`awk '/^_____ARCHIVE__FOLLOWS_____/ { print NR + 1 ; exit 0 ; }' $0`
    > >> tail -n+$ARCHIVE $0 | tar xzv -C $TMPDIR
    > >> CURRENT_DIR=`pwd`
    > >> cd $TMPDIR
    > >> ./LinuxBuildRawInstaller
    > >> _____ARCHIVE__FOLLOWS_____
    > >> ^_<8b>^H^@? ????H^@^C??\ t ?.... (binary data for the tar file)

    >
    > > Assuming you have an archiving tool, I don't see why not.

    >
    > 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.)- Hide quoted text -
    >


    ok... it's not complete. But, here is a script that will take a zip
    file embeded as a base-64 string and write it to the temp path. I
    started working out the unzip code, but to be honest, I don't feel
    like it

    ################################################## ################################################## #########################
    $CURR_PATH = get-location
    $TEMP_PATH = [IO.Path]::Combine([IO.Path]::GetTempPath(),
    "InstallDir")
    new-item -type directory $TEMP_PATH | out-null
    set-location $TEMP_PATH

    $s = @"
    UEsDBBQAAgAIANatojRA08inHDQCAABABQAUAAAAQ29uc29sZT IvQ29uc29sZS5leGXsvQt8VNW1
    ODyPk
    +QAQ2bQCYwaZdRRo4k0mqjBCTaQZBIhCWdmkhm8hITeYppGatG cAbyGKJ0Zm5PNKPZqr23V
    6lfbaqWt7bUVWx8TApmAvFGMxQcv60knaCgC4SHnv9beZ155aL jf/
    977+36fo2Hm7LPP3muvvfba
    67XXqf6XtRq9RqPh4E9RNJr1GvYp0Yzjo9VoMqf/JVPz8oRtl6/XVm27vLb5u63WZfd+/
    zv3fut7
    1m9/6+67vy9a//VO672+u63fvdtaNt9t/d73l9w5Y/
    LkiTa1iXlvVO81fnRlMPY3cU9ecBL9bgtq
    4Pv42Vvpdfa77cHJ8L0GvrX0fnuQp89cEZz8AV6XBmfA9aG3Vw Uz6f376Lfru99uxnbHGoJQrtFU

    a bunch of data

    aTnNla94y2Jl+zVG7SRtxkTNTsDMYi0tu/Ln8NuEN/UMO/jbxPCm0SS
    +NSVp7B58dPRfk3ptipeb
    kvoXnZzGgl08Ay08pvkvfzoyOE1lcgHA+USGRsND+6PN5Qzxzp UifBd1q
    +PaqU8FDD5WGP2Me5d8
    AAAAAAAAAAEAIAAAACI4AgBDb25zb2xlMi9Db25zb2xlSG9vay 5kbGxQSwECFAAUAAIACAAwmCQz
    4imAKeVSBwAAIBAAFgAAAAAAAAABACAAAACEjAIAQ29uc29sZT IvRnJlZUltYWdlLmRsbFBLAQIU
    ABQAAgAIADKYJDOrbuB
    +z3UAAAAgAQAaAAAAAAAAAAEAIAAAAJ3fCQBDb25zb2xlMi9Gc mVlSW1h
    Z2VQbHVzLmRsbFBLBQYAAAAABQAFAFYBAACkVQoAAAA=
    "@

    $zipName = "data.zip"
    [IO.File]::WriteAllBytes([IO.Path]::Combine($TEMP_PATH, $zipName),
    [Convert]::FromBase64String($s))

    # this is where and what we'd use to unzip the file - but, it needs
    # to be a recursive type function - i just don't feel like doing it
    right now
    # but it does work to this point...
    $shell = new-object -comobject shell.application
    $zipFile = $shell.NameSpace((convert-path $zipName))
    $zipFile.Items() | select-object Name | fl

    # assuming we were going to run a script from here
    #./installscript.ps1

    set-location $CURR_PATH
    remove-item -recurse $TEMP_PATH
    ################################################## ################################################## ################################

    HTH

    --
    Tom Shelton

  17. Re: Windows PowerShell vs. bash examples

    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

  18. Re: Windows PowerShell vs. bash examples

    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"




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

  19. Re: Windows PowerShell vs. bash examples

    On Thu, 06 Nov 2008 03:07:54 +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.

    How long have you been reading COLA ?





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

  20. Re: Windows PowerShell vs. bash examples

    On Wed, 05 Nov 2008 18:26:57 -0600, jebblue wrote:

    > On Tue, 04 Nov 2008 01:46:26 -0800, Tom Shelton wrote:
    >
    >> On Nov 3, 11:01*pm, jebblue wrote:
    >>> On Mon, 03 Nov 2008 21:31:08 -0800, Tom Shelton wrote:
    >>> > His post was pure crap. *None of that was powershell. *Those were
    >>> > old vbscripts.
    >>>
    >>> > Eric already posted a real powershell example... *Do you want more?
    >>>
    >>> I tried Powershell. Powershell is no BASH. KSH from the mid 90's is
    >>> more powerful. BASH actually makes sense ... and is multi-platform.
    >>>
    >>> --
    >>> // This is my opinion.

    >>
    >> Liar.
    >>
    >> HTH

    >
    > And if you are the real Tom Shelton then you owe me an apology for being
    > very rude and hurtful. I stated my opinion, my view.


    Don't let it bother you jebblue, this is COLA where Wintrolls infest,
    forge and have bad manners and smelly breath.

    Your line "// This is my opinion." clearly explained your position, and I
    found your post perfectly acceptable.

    Keep up the good work!


    Terry





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

+ Reply to Thread
Page 3 of 11 FirstFirst 1 2 3 4 5 ... LastLast