inspired by a random chat in #opensolaris (irc.freenode.net) with alan and ben, i wrote the following command line statement you can type in (works on bash!) to download OpenSolaris x86 bits in one fell swoop:

for url in wget -q -O - "http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=7&PartDetailId=Open-Sol-1-EA-Sp-x86-G-B&TransactionId=noreg" | grep "<a HREF.*EComTicketServlet" | awk -F\" '{print $2;}'; do if [ ! -f $(basename "$url") ]; then wget "$url" -O $(basename "$url"); fi; done

note: that’s all on one line.

it even checks to see if the file exists beforehand.

No Trackbacks to “download opensolaris in one easy command line operation”

6 Comments to “download opensolaris in one easy command line operation”

  1. ux-admin Says:

    Please don’t say “works on bash!” It’s not something to be proud of. bash is a really bad, broken piece of software. We really should spend some time to educate people about tcsh and perhaps zsh. Most of the people I work with that sing kudos to bash do so only because they’re completely unaware that there are better and more functions things like tcsh and zsh out there.

  2. Stephen Lau Says:

    i’ve never had bash fail on me for anything i need it to do, so why switch?

    what kind of car do you drive? are you aware that there are better cars out there? why don’t you switch? because the cost of switching is expensive (i.e.: learning a whole new syntax; or in the car analogy: purchasing a whole new car), and your current car is fine. it gets you from point A to point B.

    it becomes dangerous when you get religious about software… whatever technical merits you may be preaching (and you didn’t actually outline any reasons why tcsh/zsh are better) get lost in the message.

  3. Vladimir Kotal Says:

    I think that the general opinon ‘bash is bad’ stems from the fact that bash offers “non-standard” features above other shells. This can result in non-functional scripts in an enviroment where multiplicity of shell scripts is used. For example, most of my colleagues (UNIX admins) write shell scripts in bash but on production servers they are often run under /bin/sh or zsh which causes problems because they tend to use bash-specific features (http://www.tldp.org/LDP/abs/html/portabilityissues.html) without knowing this.

  4. Stephen Lau Says:

    Right – but this isn’t a “bash is bad” problem… this is a “non-portable code is bad” problem, and this is endemic of any code. the same thing happens when you write C code, but all you have on your target machine is a JVM and no C compiler. is it fair to say “C is bad!”. no, of course not. it’s the programmer that is at fault for writing non-portable code.

    blame the coder, not the tool. :)

  5. ux-admin Says:

    To answer your question — somewhat belatedly — I drive a car optimized for performance in every respect. I spared no expense either — did the research of the designs, did the planning. But then again, I’ve been working on cars since I was about four years old, so when I pick an automobile, you can bet good money it’ll be something not good, but awesome, even if that is not apparent at first glance.

    Could I go buy a better car? Perhaps, perhaps not, but I could certainly go out right now and buy just about any car I fancy. So the analogy your’re trying to make here doesn’t compute, at least not in my case.

    Moving right along, it is shells like bash that encourage writing of unportable code, but what’s even worse, they create a negative downward spiral of ignorance. And excellent example of that is lobbying to make bash the default shell for all users — including root — a proposition that can only stem from lack of experience.

    So where is the problem? It’s not in bash — that’s effect. What is the cause then? Lack of education. How do we fix it? We educate users. Point out that bash is not the right tool for the job, becase of this, that, and the other. Since we still lack constructivness, point out the alternatives that do work right and encourage writing portable code.

  6. ux-admin Says:

    And BTW, I never suggested that bash is an evil spawn of satan — I’m an engineer, I don’t do myths, only facts.

Leave a Reply


Recent posts