Last active
December 5, 2021 14:27
Revisions
-
webdevel revised this gist
Mar 10, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ GetOpts Example -------------- Shell script example of using GetOpts with Git Submodule. ```bash #!/bin/sh -
webdevel created this gist
Mar 10, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ GetOpts Example -------------- ```bash #!/bin/sh REMOTE=origin BRANCH=dev showHelp() { cat << EOF Pull in the latest changes from remote branch. Usage: $(basename $0) [OPTIONS] OPTIONS: -h Show this help message -b Branch name (default: $BRANCH) -r Remote alias (default: $REMOTE) EOF } while getopts "hr:b:" option; do case $option in r) REMOTE=$OPTARG ;; b) BRANCH=$OPTARG ;; h) showHelp exit ;; esac done git pull $REMOTE $BRANCH git submodule foreach git pull $REMOTE $BRANCH ```