Skip to content

Instantly share code, notes, and snippets.

@greymd
Created April 20, 2017 12:09
Show Gist options
  • Save greymd/184e1400ef8e93d45a81187fe464c641 to your computer and use it in GitHub Desktop.
Save greymd/184e1400ef8e93d45a81187fe464c641 to your computer and use it in GitHub Desktop.
shift within multiple functions with bash
parse1() {
    echo "$1"
    shift
    parse2 "$@"
    echo "$1"
}

parse2() {
    echo "$1"
    shift
    echo "$1"
}

parse1 "$@"

result

1
2
3
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment