Goody7

Q: shellschock - bash bug

Has anyone heard of the bash bug, shellshock.  Google it.  I'd like to hear what anyone thinks about how this might affect the average Mac user, as the mac ecosystem runs off linux and many apps us bash, or bourne shell, etc ... and websites that run off apache.  Anyone?

GarageBand (Mac) '11, OS X Mavericks (10.9.2)

Posted on Sep 26, 2014 6:46 AM

Close

Q: shellschock - bash bug

  • All replies
  • Helpful answers

Previous Page 2
  • by VikingOSX,

    VikingOSX VikingOSX Oct 11, 2014 10:32 AM in response to BobHarris
    Level 7 (21,510 points)
    Mac OS X
    Oct 11, 2014 10:32 AM in response to BobHarris

    As much as I have used AWK, I knew what associative arrays are, but posted above script with incorrect usage for the nomenclature. D'oh.

     

    The following works with Bash v3.2.53 on OS X 10.9.5. There is no explicit -A support in this version of Bash.

     

    Screen Shot 2014-10-11 at 1.30.36 PM.png

  • by BobHarris,

    BobHarris BobHarris Oct 11, 2014 5:01 PM in response to VikingOSX
    Level 6 (19,672 points)
    Mac OS X
    Oct 11, 2014 5:01 PM in response to VikingOSX

    Modifying my script to use the ShellShock patched /bin/bash and lower case -a I get the following results:

     

    /bin/bash --version

    GNU bash, version 3.2.53(1)-release (x86_64-apple-darwin13)

    Copyright (C) 2007 Free Software Foundation, Inc.

     

    /bin/bash not_so_associative_array_example.sh  # run the example

    xyz

    0

    xyz

    xyz

     

    It should be:

     

    def xyz

    abc_key qrs_key

    def

    xyz

     

    I think it just treated foo as index zero in your example, and in my example "abc_key" and "qrs_key" were also treated as zero, so the last thing stored in array element 0 was the value returned.

     

    As much as I have used AWK,...

    It is always nice to find someone else that likes awk.  So many people do not appreciate awk, and at most use it just to pick a field out of a string, or worse they insist on doing "cat file | awk '...'" instead of "awk '...' file".  Anyway, I do like to find people that like awk.

Previous Page 2