Re: Windows PowerShell vs. bash examples
After takin' a swig o' grog, Tom Shelton belched out
this bit o' wisdom:
[color=blue]
> On Nov 5, 10:01?am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=green]
>> After takin' a swig o' grog, Tom Shelton belched out
>> ? this bit o' wisdom:
>>[color=darkred]
>> > On Nov 5, 5:57?am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[/color]
>>[color=darkred]
>> >> I'm wondering if you can build self-installing compressed archives using
>> >> only Powershell and command-line commands.[/color]
>>[color=darkred]
>> > 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.[/color]
>>
>> 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)[/color]
>
> Assuming you have an archiving tool, I don't see why not.[/color]
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.)
Re: Windows PowerShell vs. bash examples
On Nov 5, 11:54*am, JEDIDIAH <j...@nomad.mishnet> wrote:[color=blue]
> On 2008-11-05, Tom Shelton <tom_shel...@comcast.net> wrote:
>
>
>[color=green]
> > On Nov 5, 12:02*am, Terry Porter <linu...@netspace.net.au> wrote:[color=darkred]
> >> On Mon, 03 Nov 2008 21:31:08 -0800, Tom Shelton wrote:
> >> > On Nov 3, 7:19*pm, Terry Porter <linu...@netspace.net.au> wrote:
> >> >> [crossposts snipped][/color][/color]
>[color=green][color=darkred]
> >> >> On Sun, 02 Nov 2008 22:37:57 -0600, Ignoramus22113 wrote:[/color][/color]
> [deletia][color=green][color=darkred]
> >> 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.[/color][/color]
>[color=green][color=darkred]
> >> I'm not surprised that the reality is a lot less than the claims when it
> >> comes to Erik.[/color][/color]
>[color=green][color=darkred]
> >> Colour me underwhelmed.[/color][/color]
>[color=green]
> > The leap in technology is not the relative ease of use. *Somethings in
> > powershell are harder, some are easier.[/color]
>[color=green]
> > 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:[/color]
>
> ...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.[/color]
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
Re: Windows PowerShell vs. bash examples
On Nov 5, 12:33*pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=blue]
> After takin' a swig o' grog, Tom Shelton belched out
> * this bit o' wisdom:
>
>
>[color=green]
> > On Nov 5, 9:55*am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=darkred]
> >> After takin' a swig o' grog, Tom Shelton belched out[/color][/color]
>[color=green][color=darkred]
> >> > $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[/color][/color]
>[color=green][color=darkred]
> >> Python:[/color][/color]
>[color=green][color=darkred]
> >>[url]http://www.thescriptlibrary.com/default.asp?Action=Display&Level=Cate...Information&Title=List[/url] Operating System Properties[/color][/color]
>[color=green][color=darkred]
> >> 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[/color][/color]
>[color=green]
> > 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 :)[/color]
>
> 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.
>[/color]
word wrap :) it's two lines on the command prompt - could be one.
--
Tom Shelton
Re: Windows PowerShell vs. bash examples
On Nov 5, 12:35*pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=blue]
> After takin' a swig o' grog, Tom Shelton belched out
> * this bit o' wisdom:
>
>
>[color=green]
> > On Nov 5, 10:01?am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=darkred]
> >> After takin' a swig o' grog, Tom Shelton belched out
> >> ? this bit o' wisdom:[/color][/color]
>[color=green][color=darkred]
> >> > On Nov 5, 5:57?am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[/color][/color]
>[color=green][color=darkred]
> >> >> I'm wondering if you can build self-installing compressed archives using
> >> >> only Powershell and command-line commands.[/color][/color]
>[color=green][color=darkred]
> >> > 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.[/color][/color]
>[color=green][color=darkred]
> >> 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:[/color][/color]
>[color=green][color=darkred]
> >> #!/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)[/color][/color]
>[color=green]
> > Assuming you have an archiving tool, I don't see why not.[/color]
>
> 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.)[/color]
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
Re: Windows PowerShell vs. bash examples
On Nov 5, 12:31 pm, Tom Shelton <tom_shel...@comcast.net> wrote:[color=blue]
> On Nov 5, 12:35 pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:
>
>
>[color=green]
> > After takin' a swig o' grog, Tom Shelton belched out
> > this bit o' wisdom:[/color]
>[color=green][color=darkred]
> > > On Nov 5, 10:01?am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:
> > >> After takin' a swig o' grog, Tom Shelton belched out
> > >> ? this bit o' wisdom:[/color][/color]
>[color=green][color=darkred]
> > >> > On Nov 5, 5:57?am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[/color][/color]
>[color=green][color=darkred]
> > >> >> I'm wondering if you can build self-installing compressed archives using
> > >> >> only Powershell and command-line commands.[/color][/color]
>[color=green][color=darkred]
> > >> > 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.[/color][/color]
>[color=green][color=darkred]
> > >> 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:[/color][/color]
>[color=green][color=darkred]
> > >> #!/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)[/color][/color]
>[color=green][color=darkred]
> > > Assuming you have an archiving tool, I don't see why not.[/color][/color]
>[color=green]
> > 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.)[/color]
>
> 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[/color]
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.
Re: Windows PowerShell vs. bash examples
On Nov 5, 2:11*pm, The Ghost In The Machine <ewi...@earthlink.net>
wrote:[color=blue]
> On Nov 5, 12:31 pm, Tom Shelton <tom_shel...@comcast.net> wrote:
>
>
>[color=green]
> > On Nov 5, 12:35 pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[/color]
>[color=green][color=darkred]
> > > After takin' a swig o' grog, Tom Shelton belched out
> > > * this bit o' wisdom:[/color][/color]
>[color=green][color=darkred]
> > > > On Nov 5, 10:01?am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:
> > > >> After takin' a swig o' grog, Tom Shelton belched out
> > > >> ? this bit o' wisdom:[/color][/color]
>[color=green][color=darkred]
> > > >> > On Nov 5, 5:57?am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[/color][/color]
>[color=green][color=darkred]
> > > >> >> I'm wondering if you can build self-installing compressed archives using
> > > >> >> only Powershell and command-line commands.[/color][/color]
>[color=green][color=darkred]
> > > >> > 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.[/color][/color]
>[color=green][color=darkred]
> > > >> 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:[/color][/color]
>[color=green][color=darkred]
> > > >> #!/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)[/color][/color]
>[color=green][color=darkred]
> > > > Assuming you have an archiving tool, I don't see why not.[/color][/color]
>[color=green][color=darkred]
> > > 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.)[/color][/color]
>[color=green]
> > 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.[/color]
>[color=green]
> > --
> > Tom Shelton[/color]
>
> 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.
>[/color]
The problem is embeding it in the script. Not passing around byte
streams.
[color=blue]
> 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.
>[/color]
Not a problem. you have a lot of control over the serialized format
of any .NET object.
[color=blue]
> 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.)
>[/color]
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
Re: Windows PowerShell vs. bash examples
After takin' a swig o' grog, Tom Shelton belched out
this bit o' wisdom:
[color=blue]
> 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.[/color]
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
Re: Windows PowerShell vs. bash examples
After takin' a swig o' grog, Tom Shelton belched out
this bit o' wisdom:
[color=blue]
> On Nov 5, 12:35*pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=green]
>>
>> 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.)[/color]
>
> 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.[/color]
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.
Re: Windows PowerShell vs. bash examples
Chris Ahlstrom <linonut@bollsouth.nut> writes:
[color=blue]
> After takin' a swig o' grog, Tom Shelton belched out
> this bit o' wisdom:
>[color=green]
>> On Nov 5, 12:35Â*pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=darkred]
>>>
>>> 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.)[/color]
>>
>> 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.[/color]
>
> 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.[/color]
Wrong again. It is limited and why people must use xargs.
[url]http://www.ss64.com/bash/xargs.html[/url]
Re: Windows PowerShell vs. bash examples
On Tue, 04 Nov 2008 01:46:26 -0800, Tom Shelton wrote:
[color=blue]
> On Nov 3, 11:01Â*pm, jebblue <n...@n.nnn> wrote:[color=green]
>> On Mon, 03 Nov 2008 21:31:08 -0800, Tom Shelton wrote:[color=darkred]
>> > His post was pure crap. Â*None of that was powershell. Â*Those were old
>> > vbscripts.[/color]
>>[color=darkred]
>> > Eric already posted a real powershell example... Â*Do you want more?[/color]
>>
>> 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.[/color]
>
> Liar.
>
> HTH[/color]
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.
Re: Windows PowerShell vs. bash examples
After takin' a swig o' grog, Steve Townsend belched out
this bit o' wisdom:
[color=blue]
> Chris Ahlstrom <linonut@bollsouth.nut> writes:
>[color=green]
>> 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.[/color]
>
> Wrong again. It is limited and why people must use xargs.
>
> [url]http://www.ss64.com/bash/xargs.html[/url][/color]
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:
[url]http://www.mkssoftware.com/docs/man1/awk.1.asp[/url]
Remember to read for comprehension, dude.
--
Welcome to the Zoo!
Re: Windows PowerShell vs. bash examples
On Nov 5, 3:37*pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=blue]
> After takin' a swig o' grog, Tom Shelton belched out
> * this bit o' wisdom:
>[color=green]
> > 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.[/color]
>
> Well, maybe the "pash" app that Mike linked to would be useful, then.
>
> Powershell is not, for Linux users.
>[/color]
That's true. At least for now. But since, PowerShell is based
on .NET, you should be able to port it to Mono :)
[color=blue]
> I think I'd stick with Python.
>[/color]
Not a bad choice, if you really need to be cross platform.
--
Tom Shelton
Re: Windows PowerShell vs. bash examples
On Nov 5, 3:39*pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=blue]
> After takin' a swig o' grog, Tom Shelton belched out
> * this bit o' wisdom:
>[color=green]
> > On Nov 5, 12:35*pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[/color]
>[color=green][color=darkred]
> >> 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.)[/color][/color]
>[color=green]
> > 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.[/color]
>
> No need, unless you want to do it.
>[/color]
I'm in fact going to see what I can do right now :) It's an
interesting problem.
[color=blue]
> 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.[/color]
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
Re: Windows PowerShell vs. bash examples
On Nov 5, 6:29*pm, Tom Shelton <tom_shel...@comcast.net> wrote:[color=blue]
> On Nov 5, 3:39*pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:
>
>
>
>
>[color=green]
> > After takin' a swig o' grog, Tom Shelton belched out
> > * this bit o' wisdom:[/color]
>[color=green][color=darkred]
> > > On Nov 5, 12:35*pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[/color][/color]
>[color=green][color=darkred]
> > >> 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.)[/color][/color]
>[color=green][color=darkred]
> > > 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.[/color][/color]
>[color=green]
> > No need, unless you want to do it.[/color]
>
> I'm in fact going to see what I can do right now :) *It's an
> interesting problem.
>[color=green]
> > 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.[/color]
>
> 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 -[/color]
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
Re: Windows PowerShell vs. bash examples
Chris Ahlstrom <linonut@bollsouth.nut> writes:
[color=blue]
> After takin' a swig o' grog, Steve Townsend belched out
> this bit o' wisdom:
>[color=green]
>> Chris Ahlstrom <linonut@bollsouth.nut> writes:
>>[color=darkred]
>>> 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.[/color]
>>
>> Wrong again. It is limited and why people must use xargs.
>>
>> [url]http://www.ss64.com/bash/xargs.html[/url][/color]
>
> 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?[/color]
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.
[color=blue]
>
> Where do I say that size limits are not important in GNU. GNU has a[/color]
Where did I say it was? I was talking about bash. Not Gnu.
[color=blue]
> 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?[/color]
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.
Re: Windows PowerShell vs. bash examples
On Nov 5, 12:35*pm, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=blue]
> After takin' a swig o' grog, Tom Shelton belched out
> * this bit o' wisdom:
>
>
>
>
>[color=green]
> > On Nov 5, 10:01?am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=darkred]
> >> After takin' a swig o' grog, Tom Shelton belched out
> >> ? this bit o' wisdom:[/color][/color]
>[color=green][color=darkred]
> >> > On Nov 5, 5:57?am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[/color][/color]
>[color=green][color=darkred]
> >> >> I'm wondering if you can build self-installing compressed archives using
> >> >> only Powershell and command-line commands.[/color][/color]
>[color=green][color=darkred]
> >> > 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.[/color][/color]
>[color=green][color=darkred]
> >> 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:[/color][/color]
>[color=green][color=darkred]
> >> #!/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)[/color][/color]
>[color=green]
> > Assuming you have an archiving tool, I don't see why not.[/color]
>
> 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 -
>[/color]
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 = @"
UEsDBBQAAgAIANatojRA08inHDQCAABABQAUAAAAQ29uc29sZTIvQ29uc29sZS5leGXsvQt8VNW1
ODyPk
+QAQ2bQCYwaZdRRo4k0mqjBCTaQZBIhCWdmkhm8hITeYppGatGcAbyGKJ0Zm5PNKPZqr23V
6lfbaqWt7bUVWx8TApmAvFGMxQcv60knaCgC4SHnv9beZ155aLjf/
977+36fo2Hm7LPP3muvvfba
67XXqf6XtRq9RqPh4E9RNJr1GvYp0Yzjo9VoMqf/JVPz8oRtl6/XVm27vLb5u63WZfd+/
zv3fut7
1m9/6+67vy9a//VO672+u63fvdtaNt9t/d73l9w5Y/
LkiTa1iXlvVO81fnRlMPY3cU9ecBL9bgtq
4Pv42Vvpdfa77cHJ8L0GvrX0fnuQp89cEZz8AV6XBmfA9aG3VwUz6f376Lfru99uxnbHGoJQrtFU
<snip> a bunch of data </snip>
aTnNla94y2Jl+zVG7SRtxkTNTsDMYi0tu/Ln8NuEN/UMO/jbxPCm0SS
+NSVp7B58dPRfk3ptipeb
kvoXnZzGgl08Ay08pvkvfzoyOE1lcgHA+USGRsND+6PN5QzxzpUifBd1q
+PaqU8FDD5WGP2Me5d8
AAAAAAAAAAEAIAAAACI4AgBDb25zb2xlMi9Db25zb2xlSG9vay5kbGxQSwECFAAUAAIACAAwmCQz
4imAKeVSBwAAIBAAFgAAAAAAAAABACAAAACEjAIAQ29uc29sZTIvRnJlZUltYWdlLmRsbFBLAQIU
ABQAAgAIADKYJDOrbuB
+z3UAAAAgAQAaAAAAAAAAAAEAIAAAAJ3fCQBDb25zb2xlMi9GcmVlSW1h
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
Re: Windows PowerShell vs. bash examples
On Wed, 05 Nov 2008 03:30:49 -0800, Kelsey Bjarnason wrote:
[color=blue]
> [snips]
>
> On Wed, 05 Nov 2008 03:07:55 -0500, Erik Funkenbusch wrote:
>[color=green][color=darkred]
>>> Because I'm underwhelmed Erik. Powershell appears no better than the
>>> methods Linux users have had for the last 15 years or so.[/color]
>>
>> 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.[/color]
>
> Err... a one-liner can be a fairly powerful critter. Try this:
>
> " does. - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"[/color]
We are all waiting for your "PowerShill" equivalent to Kelseys example
Erik ...
--
Linux full time, on the desktop, since August 1997
Re: Windows PowerShell vs. bash examples
On Wed, 05 Nov 2008 08:43:39 -0800, Tom Shelton wrote:
[color=blue]
> On Nov 5, 5:57Â*am, Chris Ahlstrom <lino...@bollsouth.nut> wrote:[color=green]
>> After takin' a swig o' grog, Kelsey Bjarnason belched out[/color][/color]
[color=blue][color=green][color=darkred]
>> > tar cvzf - /wwwdata | ssh ssh user@host "dd of=/path/wwwdata.tar.gz"[/color]
>>
>> I'm wondering if you can build self-installing compressed archives
>> using only Powershell and command-line commands.
>>
>>[/color]
> Out of the box, probably not. <snip>[/color]
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
Re: Windows PowerShell vs. bash examples
On Thu, 06 Nov 2008 03:07:54 +0100, Steve Townsend wrote:
<snip>[color=blue]
> 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.[/color]
<snip>
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
Re: Windows PowerShell vs. bash examples
On Wed, 05 Nov 2008 18:26:57 -0600, jebblue wrote:
[color=blue]
> On Tue, 04 Nov 2008 01:46:26 -0800, Tom Shelton wrote:
>[color=green]
>> On Nov 3, 11:01Â*pm, jebblue <n...@n.nnn> wrote:[color=darkred]
>>> 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.[/color]
>>
>> Liar.
>>
>> HTH[/color]
>
> 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.[/color]
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