z/OS Tools & Language

Expand all | Collapse all

Bash arrays not working properly?

  • 1.  Bash arrays not working properly?

    Posted 02-11-2018 15:22

    Here’s a little script, call it mygit, that works for me on Ubuntu Linux:

    #!/usr/bin/bash
    git ${@}
    
    > mygit commit -m "Two words."
    [commit works; commit message is "Two words."]
    

    It doesn’t work on z/OS, though:

    #!/rsusr/ported/bin/bash
    git ${@}
    
    > mygit commit -m "Two words."
    error: pathspec 'words.' did not match any file(s) known to git.
    

    It looks like the array of input parameters is being passed to the git command as individual words, not as a proper array. How do I make this work?



  • 2.  RE: Bash arrays not working properly?

    Posted 02-12-2018 08:22

    Hi Tony,

    I have no idea, why it works on Ubuntu. Cause it doesn’t work on CentOS. And it is normal bash behavior:
    Link1
    Link2

    Use this script:

    #!/rsusr/ported/bin/bash
    git "${@}"
    

    Thanks,
    Tatyana



  • 3.  RE: Bash arrays not working properly?

    Posted 02-12-2018 13:18

    Of course. How intuitive.

    Thanks, Tatyana. :slight_smile: