castastrophe / bash-helper-scripts

Helper functions written in Bash to help with daily tasks that are repetitive and eat up time.
GNU General Public License v2.0
2 stars 1 forks source link

Bash helper scripts

These are a few helper functions written in Bash that I use to help with daily tasks that are repetitive and eat up time.

If you find bugs or make updates to these scripts that would be beneficial to others, please contribute them back to the community.

Required for your bash_profile

  USER="<your username here>"
  DRUPAL_LOC="<path to drupal install on sandboxes here>"
  REPOS=(list of supported project repositories)
  REPO_HOME=<local path to where your repositories are installed>

  # Return the url of the sandbox
  function sandbox {
    echo "${2:-root}@<url-of-sandbox>-${1:-$USER}<url-of-sandbox>"
  }

  # Determine master branch by repo convention if not master
  function getMaster {
    master="master"

    # logic to determine the appropriate development root on which to build your branches
    [[ $(pwd | grep -i "<name of repo>") ]] && master="<name of development branch>"
    ...

    # return
    echo $master
  }

  #Load functions
  for file in $(find <local path where you keep these scripts> -type f -name "functions-*"); do
    test -f $file && . $_
  done

functions-git

functions-dev

Red Hat project-specific tasks

These will be less useful for general audiences.

functions-webux

functions-webrh