Output of “${OSTYPE:6}” on old releases of Mac OS Xodd behavior of pgrep in bash scriptDownloading old...

Did the CIA blow up a Siberian pipeline in 1982?

What does "play with your toy’s toys" mean?

How to remove this component from PCB

Array initialization optimization

Is this proposal by U.S. presidential candidate Pete Buttigieg to change the composition of the Supreme Court constitutional?

What's currently blocking the construction of the wall between Mexico and the US?

What size of powerbank will I need to power a phone and DSLR for 2 weeks?

What exactly is the 'online' in OLAP and OLTP?

How is hair tissue mineral analysis performed?

Has there been any indication at all that further negotiation between the UK and EU is possible?

How do I professionally let my manager know I'll quit over smoking in the office?

Hot coffee brewing solutions for deep woods camping

What is the legal status of travelling with methadone in your carry-on?

How do I turn off a repeating trade?

Understanding the reasoning of the woman who agreed with King Solomon to "cut the baby in half"

How does a blind passenger not die, if driver becomes unconscious

Trainee keeps missing deadlines for independent learning

Drawing people along with x and y axis

Is a single radon-daughter atom in air a solid?

Unusual mail headers, evidence of an attempted attack. Have I been pwned?

Is it illegal to withhold someone's passport and green card in California?

Silly doubt about tidal effects and Einstein Field Equations

Why is prior to creation called holy?

Count All Possible Unique Combinations of Letters in a Word



Output of “${OSTYPE:6}” on old releases of Mac OS X


odd behavior of pgrep in bash scriptDownloading old Safari point releases (Ex: 8.0.4)How can I explain to my friend that running a “hackintosh” is a violation of the law?OS X 10.10 (Yosemite) Custom Shutdown Screen/BehaviorIs 10.10.5 more stable than 10.10.0?iMac fails to complete boot from main drive with flashing black screenMac terminal strange output on returnTerminal login hangsHow do I install macOS 10.11 El Capitan on a Mac mini (Late 2012)Mac mini periodically dumps all connected file-sharing users






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







4















I'm writing a shell script that I want to be theoretically compatible with very old versions of Mac OS X (I say "theoretically", because I lack any super-old machines to actually test with). The script uses the output of ${OSTYPE:6} to determine which release of Mac OS X it's running on.



On a machine running 10.13 High Sierra, echo ${OSTYPE:6} returns 17. On a machine running 10.10 Yosemite, it returns 14. Logic thus suggests that the command would output "15" on 10.11 and "16" on 10.12.



(This is useful, because it allows me to include lines like if [[ ${OSTYPE:6} -ge 14 ]]; then DoThing; fi to run DoThing on any system running Yosemite and newer.)



Does this pattern hold for old releases as well? For example, would the command return "4" on the original 10.0?



I ask because, well, it would be odd to start at 4, so I'm worried that somewhere in history, the number was incremented by a point update.










share|improve this question

























  • For some older versions, it returns a dotted number pair. On OS X 10.6.8 I get "10.0", and on OS X 10.3.9 I get "7.0". Unfortunately, that means bash can't do numeric comparisons on it in these versions.

    – Gordon Davisson
    6 hours ago




















4















I'm writing a shell script that I want to be theoretically compatible with very old versions of Mac OS X (I say "theoretically", because I lack any super-old machines to actually test with). The script uses the output of ${OSTYPE:6} to determine which release of Mac OS X it's running on.



On a machine running 10.13 High Sierra, echo ${OSTYPE:6} returns 17. On a machine running 10.10 Yosemite, it returns 14. Logic thus suggests that the command would output "15" on 10.11 and "16" on 10.12.



(This is useful, because it allows me to include lines like if [[ ${OSTYPE:6} -ge 14 ]]; then DoThing; fi to run DoThing on any system running Yosemite and newer.)



Does this pattern hold for old releases as well? For example, would the command return "4" on the original 10.0?



I ask because, well, it would be odd to start at 4, so I'm worried that somewhere in history, the number was incremented by a point update.










share|improve this question

























  • For some older versions, it returns a dotted number pair. On OS X 10.6.8 I get "10.0", and on OS X 10.3.9 I get "7.0". Unfortunately, that means bash can't do numeric comparisons on it in these versions.

    – Gordon Davisson
    6 hours ago
















4












4








4








I'm writing a shell script that I want to be theoretically compatible with very old versions of Mac OS X (I say "theoretically", because I lack any super-old machines to actually test with). The script uses the output of ${OSTYPE:6} to determine which release of Mac OS X it's running on.



On a machine running 10.13 High Sierra, echo ${OSTYPE:6} returns 17. On a machine running 10.10 Yosemite, it returns 14. Logic thus suggests that the command would output "15" on 10.11 and "16" on 10.12.



(This is useful, because it allows me to include lines like if [[ ${OSTYPE:6} -ge 14 ]]; then DoThing; fi to run DoThing on any system running Yosemite and newer.)



Does this pattern hold for old releases as well? For example, would the command return "4" on the original 10.0?



I ask because, well, it would be odd to start at 4, so I'm worried that somewhere in history, the number was incremented by a point update.










share|improve this question
















I'm writing a shell script that I want to be theoretically compatible with very old versions of Mac OS X (I say "theoretically", because I lack any super-old machines to actually test with). The script uses the output of ${OSTYPE:6} to determine which release of Mac OS X it's running on.



On a machine running 10.13 High Sierra, echo ${OSTYPE:6} returns 17. On a machine running 10.10 Yosemite, it returns 14. Logic thus suggests that the command would output "15" on 10.11 and "16" on 10.12.



(This is useful, because it allows me to include lines like if [[ ${OSTYPE:6} -ge 14 ]]; then DoThing; fi to run DoThing on any system running Yosemite and newer.)



Does this pattern hold for old releases as well? For example, would the command return "4" on the original 10.0?



I ask because, well, it would be odd to start at 4, so I'm worried that somewhere in history, the number was incremented by a point update.







macos






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 8 hours ago







Wowfunhappy

















asked 9 hours ago









WowfunhappyWowfunhappy

1,42811231




1,42811231













  • For some older versions, it returns a dotted number pair. On OS X 10.6.8 I get "10.0", and on OS X 10.3.9 I get "7.0". Unfortunately, that means bash can't do numeric comparisons on it in these versions.

    – Gordon Davisson
    6 hours ago





















  • For some older versions, it returns a dotted number pair. On OS X 10.6.8 I get "10.0", and on OS X 10.3.9 I get "7.0". Unfortunately, that means bash can't do numeric comparisons on it in these versions.

    – Gordon Davisson
    6 hours ago



















For some older versions, it returns a dotted number pair. On OS X 10.6.8 I get "10.0", and on OS X 10.3.9 I get "7.0". Unfortunately, that means bash can't do numeric comparisons on it in these versions.

– Gordon Davisson
6 hours ago







For some older versions, it returns a dotted number pair. On OS X 10.6.8 I get "10.0", and on OS X 10.3.9 I get "7.0". Unfortunately, that means bash can't do numeric comparisons on it in these versions.

– Gordon Davisson
6 hours ago












3 Answers
3






active

oldest

votes


















4














That sounds very much like it's returning the Darwin version.



Your theory works well from 10.15 Mojave [18] back to 10.2 Jaguar [6] but fails before that, as Darwin was 1.x.x at that point.



There's a full list at Wikipedia - macOS






share|improve this answer



















  • 1





    $OSTYPE is a z shell parameter which is derived from uname -r.

    – fd0
    8 hours ago






  • 1





    @fd0 - that may as well be Martian ;-)

    – Tetsujin
    8 hours ago



















0














Apple stores version information in Core Foundation and here is the source code showing how they build to each version.




  • https://opensource.apple.com/source/DarwinTools/DarwinTools-1/sw_vers.c.auto.html


I’d use sw_vers to get your version information if you’re scripting rather than use uname or other variables.






share|improve this answer
























  • Would sw_vers work in a shell script?

    – Wowfunhappy
    8 hours ago













  • It’s in the path of all the shipping shells on macOS / OS X / Darwin, so yes @Wowfunhappy it will work well.

    – bmike
    8 hours ago











  • Thanks. I remember why I didn't use this now—because it doesn't output an integer like OSTYPE:6, I can't use a simple -ge / -le checks to isolate "this version and everything newer/older"

    – Wowfunhappy
    8 hours ago













  • @Wowfunhappy Aren’t the build numbers monotonically increasing and sortable as strings? I think there’s an entire python library / module to handle this iirc - it’s pyfacts - github.com/timsutton/python-macadmin-tools

    – bmike
    8 hours ago













  • Ah, Finlay Doobie, who fixed a bug in OS X that escaped Apple's software engineers for over a year - wired.com/2002/03/apple-ousts-coder-for-being-young

    – fd0
    7 hours ago



















0














I don't have a 10.0 machine to test on, but on a 10.3 machine, echo ${OSTYPE:6} returns a blank line; on 10.6, it returns 10.0.



(Incidentally, your shell script would need to explicitly invoke bash. The default shell on very old versions of OSX is tcsh, which doesn't understand the ${OSTYPE:6} syntax.)





share

































    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    That sounds very much like it's returning the Darwin version.



    Your theory works well from 10.15 Mojave [18] back to 10.2 Jaguar [6] but fails before that, as Darwin was 1.x.x at that point.



    There's a full list at Wikipedia - macOS






    share|improve this answer



















    • 1





      $OSTYPE is a z shell parameter which is derived from uname -r.

      – fd0
      8 hours ago






    • 1





      @fd0 - that may as well be Martian ;-)

      – Tetsujin
      8 hours ago
















    4














    That sounds very much like it's returning the Darwin version.



    Your theory works well from 10.15 Mojave [18] back to 10.2 Jaguar [6] but fails before that, as Darwin was 1.x.x at that point.



    There's a full list at Wikipedia - macOS






    share|improve this answer



















    • 1





      $OSTYPE is a z shell parameter which is derived from uname -r.

      – fd0
      8 hours ago






    • 1





      @fd0 - that may as well be Martian ;-)

      – Tetsujin
      8 hours ago














    4












    4








    4







    That sounds very much like it's returning the Darwin version.



    Your theory works well from 10.15 Mojave [18] back to 10.2 Jaguar [6] but fails before that, as Darwin was 1.x.x at that point.



    There's a full list at Wikipedia - macOS






    share|improve this answer













    That sounds very much like it's returning the Darwin version.



    Your theory works well from 10.15 Mojave [18] back to 10.2 Jaguar [6] but fails before that, as Darwin was 1.x.x at that point.



    There's a full list at Wikipedia - macOS







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 9 hours ago









    TetsujinTetsujin

    63.4k15107205




    63.4k15107205








    • 1





      $OSTYPE is a z shell parameter which is derived from uname -r.

      – fd0
      8 hours ago






    • 1





      @fd0 - that may as well be Martian ;-)

      – Tetsujin
      8 hours ago














    • 1





      $OSTYPE is a z shell parameter which is derived from uname -r.

      – fd0
      8 hours ago






    • 1





      @fd0 - that may as well be Martian ;-)

      – Tetsujin
      8 hours ago








    1




    1





    $OSTYPE is a z shell parameter which is derived from uname -r.

    – fd0
    8 hours ago





    $OSTYPE is a z shell parameter which is derived from uname -r.

    – fd0
    8 hours ago




    1




    1





    @fd0 - that may as well be Martian ;-)

    – Tetsujin
    8 hours ago





    @fd0 - that may as well be Martian ;-)

    – Tetsujin
    8 hours ago













    0














    Apple stores version information in Core Foundation and here is the source code showing how they build to each version.




    • https://opensource.apple.com/source/DarwinTools/DarwinTools-1/sw_vers.c.auto.html


    I’d use sw_vers to get your version information if you’re scripting rather than use uname or other variables.






    share|improve this answer
























    • Would sw_vers work in a shell script?

      – Wowfunhappy
      8 hours ago













    • It’s in the path of all the shipping shells on macOS / OS X / Darwin, so yes @Wowfunhappy it will work well.

      – bmike
      8 hours ago











    • Thanks. I remember why I didn't use this now—because it doesn't output an integer like OSTYPE:6, I can't use a simple -ge / -le checks to isolate "this version and everything newer/older"

      – Wowfunhappy
      8 hours ago













    • @Wowfunhappy Aren’t the build numbers monotonically increasing and sortable as strings? I think there’s an entire python library / module to handle this iirc - it’s pyfacts - github.com/timsutton/python-macadmin-tools

      – bmike
      8 hours ago













    • Ah, Finlay Doobie, who fixed a bug in OS X that escaped Apple's software engineers for over a year - wired.com/2002/03/apple-ousts-coder-for-being-young

      – fd0
      7 hours ago
















    0














    Apple stores version information in Core Foundation and here is the source code showing how they build to each version.




    • https://opensource.apple.com/source/DarwinTools/DarwinTools-1/sw_vers.c.auto.html


    I’d use sw_vers to get your version information if you’re scripting rather than use uname or other variables.






    share|improve this answer
























    • Would sw_vers work in a shell script?

      – Wowfunhappy
      8 hours ago













    • It’s in the path of all the shipping shells on macOS / OS X / Darwin, so yes @Wowfunhappy it will work well.

      – bmike
      8 hours ago











    • Thanks. I remember why I didn't use this now—because it doesn't output an integer like OSTYPE:6, I can't use a simple -ge / -le checks to isolate "this version and everything newer/older"

      – Wowfunhappy
      8 hours ago













    • @Wowfunhappy Aren’t the build numbers monotonically increasing and sortable as strings? I think there’s an entire python library / module to handle this iirc - it’s pyfacts - github.com/timsutton/python-macadmin-tools

      – bmike
      8 hours ago













    • Ah, Finlay Doobie, who fixed a bug in OS X that escaped Apple's software engineers for over a year - wired.com/2002/03/apple-ousts-coder-for-being-young

      – fd0
      7 hours ago














    0












    0








    0







    Apple stores version information in Core Foundation and here is the source code showing how they build to each version.




    • https://opensource.apple.com/source/DarwinTools/DarwinTools-1/sw_vers.c.auto.html


    I’d use sw_vers to get your version information if you’re scripting rather than use uname or other variables.






    share|improve this answer













    Apple stores version information in Core Foundation and here is the source code showing how they build to each version.




    • https://opensource.apple.com/source/DarwinTools/DarwinTools-1/sw_vers.c.auto.html


    I’d use sw_vers to get your version information if you’re scripting rather than use uname or other variables.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 8 hours ago









    bmikebmike

    164k46300643




    164k46300643













    • Would sw_vers work in a shell script?

      – Wowfunhappy
      8 hours ago













    • It’s in the path of all the shipping shells on macOS / OS X / Darwin, so yes @Wowfunhappy it will work well.

      – bmike
      8 hours ago











    • Thanks. I remember why I didn't use this now—because it doesn't output an integer like OSTYPE:6, I can't use a simple -ge / -le checks to isolate "this version and everything newer/older"

      – Wowfunhappy
      8 hours ago













    • @Wowfunhappy Aren’t the build numbers monotonically increasing and sortable as strings? I think there’s an entire python library / module to handle this iirc - it’s pyfacts - github.com/timsutton/python-macadmin-tools

      – bmike
      8 hours ago













    • Ah, Finlay Doobie, who fixed a bug in OS X that escaped Apple's software engineers for over a year - wired.com/2002/03/apple-ousts-coder-for-being-young

      – fd0
      7 hours ago



















    • Would sw_vers work in a shell script?

      – Wowfunhappy
      8 hours ago













    • It’s in the path of all the shipping shells on macOS / OS X / Darwin, so yes @Wowfunhappy it will work well.

      – bmike
      8 hours ago











    • Thanks. I remember why I didn't use this now—because it doesn't output an integer like OSTYPE:6, I can't use a simple -ge / -le checks to isolate "this version and everything newer/older"

      – Wowfunhappy
      8 hours ago













    • @Wowfunhappy Aren’t the build numbers monotonically increasing and sortable as strings? I think there’s an entire python library / module to handle this iirc - it’s pyfacts - github.com/timsutton/python-macadmin-tools

      – bmike
      8 hours ago













    • Ah, Finlay Doobie, who fixed a bug in OS X that escaped Apple's software engineers for over a year - wired.com/2002/03/apple-ousts-coder-for-being-young

      – fd0
      7 hours ago

















    Would sw_vers work in a shell script?

    – Wowfunhappy
    8 hours ago







    Would sw_vers work in a shell script?

    – Wowfunhappy
    8 hours ago















    It’s in the path of all the shipping shells on macOS / OS X / Darwin, so yes @Wowfunhappy it will work well.

    – bmike
    8 hours ago





    It’s in the path of all the shipping shells on macOS / OS X / Darwin, so yes @Wowfunhappy it will work well.

    – bmike
    8 hours ago













    Thanks. I remember why I didn't use this now—because it doesn't output an integer like OSTYPE:6, I can't use a simple -ge / -le checks to isolate "this version and everything newer/older"

    – Wowfunhappy
    8 hours ago







    Thanks. I remember why I didn't use this now—because it doesn't output an integer like OSTYPE:6, I can't use a simple -ge / -le checks to isolate "this version and everything newer/older"

    – Wowfunhappy
    8 hours ago















    @Wowfunhappy Aren’t the build numbers monotonically increasing and sortable as strings? I think there’s an entire python library / module to handle this iirc - it’s pyfacts - github.com/timsutton/python-macadmin-tools

    – bmike
    8 hours ago







    @Wowfunhappy Aren’t the build numbers monotonically increasing and sortable as strings? I think there’s an entire python library / module to handle this iirc - it’s pyfacts - github.com/timsutton/python-macadmin-tools

    – bmike
    8 hours ago















    Ah, Finlay Doobie, who fixed a bug in OS X that escaped Apple's software engineers for over a year - wired.com/2002/03/apple-ousts-coder-for-being-young

    – fd0
    7 hours ago





    Ah, Finlay Doobie, who fixed a bug in OS X that escaped Apple's software engineers for over a year - wired.com/2002/03/apple-ousts-coder-for-being-young

    – fd0
    7 hours ago











    0














    I don't have a 10.0 machine to test on, but on a 10.3 machine, echo ${OSTYPE:6} returns a blank line; on 10.6, it returns 10.0.



    (Incidentally, your shell script would need to explicitly invoke bash. The default shell on very old versions of OSX is tcsh, which doesn't understand the ${OSTYPE:6} syntax.)





    share




























      0














      I don't have a 10.0 machine to test on, but on a 10.3 machine, echo ${OSTYPE:6} returns a blank line; on 10.6, it returns 10.0.



      (Incidentally, your shell script would need to explicitly invoke bash. The default shell on very old versions of OSX is tcsh, which doesn't understand the ${OSTYPE:6} syntax.)





      share


























        0












        0








        0







        I don't have a 10.0 machine to test on, but on a 10.3 machine, echo ${OSTYPE:6} returns a blank line; on 10.6, it returns 10.0.



        (Incidentally, your shell script would need to explicitly invoke bash. The default shell on very old versions of OSX is tcsh, which doesn't understand the ${OSTYPE:6} syntax.)





        share













        I don't have a 10.0 machine to test on, but on a 10.3 machine, echo ${OSTYPE:6} returns a blank line; on 10.6, it returns 10.0.



        (Incidentally, your shell script would need to explicitly invoke bash. The default shell on very old versions of OSX is tcsh, which doesn't understand the ${OSTYPE:6} syntax.)






        share











        share


        share










        answered 1 min ago









        MarkMark

        1397




        1397















            Popular posts from this blog

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...