{"id":21862021,"url":"https://github.com/softspring/bash-utils","last_synced_at":"2026-04-11T11:33:54.968Z","repository":{"id":59893789,"uuid":"333441917","full_name":"softspring/bash-utils","owner":"softspring","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-05T07:09:14.000Z","size":113,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"5.5","last_synced_at":"2025-08-05T09:22:49.966Z","etag":null,"topics":["bash","tools"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softspring.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-27T14:11:44.000Z","updated_at":"2025-02-14T11:42:38.000Z","dependencies_parsed_at":"2023-09-29T12:06:23.339Z","dependency_job_id":"8566f2d9-a427-4097-a6db-148938eabe8c","html_url":"https://github.com/softspring/bash-utils","commit_stats":null,"previous_names":[],"tags_count":130,"template":false,"template_full_name":null,"purl":"pkg:github/softspring/bash-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softspring%2Fbash-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softspring%2Fbash-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softspring%2Fbash-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softspring%2Fbash-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softspring","download_url":"https://codeload.github.com/softspring/bash-utils/tar.gz/refs/heads/5.5","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softspring%2Fbash-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278512344,"owners_count":25999293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","tools"],"created_at":"2024-11-28T03:13:25.819Z","updated_at":"2025-10-05T20:25:00.076Z","avatar_url":"https://github.com/softspring.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bash utils\n\n[![License](https://poser.pugx.org/softspring/bash-utils/license.svg)](https://packagist.org/packages/softspring/bash-utils)\n[![Build status](https://github.com/softspring/bash-utils/actions/workflows/php.yml/badge.svg?branch=5.4)](https://github.com/softspring/bash-utils/actions/workflows/php.yml)\n\n## Create project file\n\nCreate a project file in the project root with the following content:\n\n```bash\n#!/bin/bash -e\n# #################################################################################\n# SEE https://github.com/softspring/bash-utils\n# #################################################################################\n# github .bash-utils read token\nGITHUB_ACCESS_TOKEN=\"\u003cyour-github-token\u003e\"\n\n# define paths\nBASE_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" \u0026\u0026 realpath \"$(pwd)\" )\"\nSCRIPTS_DIR=\"$BASE_DIR/.scripts\"\nUTILS_TMP_PATH=$SCRIPTS_DIR/.bash-utils ; mkdir -p \"$UTILS_TMP_PATH\"\n#UTILS_TMP_PATH=./.git/bash-utils ; mkdir -p \"$UTILS_TMP_PATH\" # \u003c to do it \"hidden\"\n\n# load last release of bash-utils\n#RELEASE_FILTER=5.4\n#BASH_UTILS_VERSION=$(curl -H \"Authorization: token $GITHUB_ACCESS_TOKEN\" -s https://api.github.com/repos/softspring/bash-utils/releases | grep '$RELEASE_FILTER' | grep 'tag_name' | head -n1 | sed -n 's/.*\"tag_name\": \"\\(.*\\)\".*/\\1/p' | tail -n2 | head -n1)\n#CURRENT_VERSION=$(cat \"$UTILS_TMP_PATH/.version\" 2\u003e /dev/null || echo '')\n#[ \"$CURRENT_VERSION\" != \"$BASH_UTILS_VERSION\" ] \u0026\u0026 echo \"# Updating bash-utils from $CURRENT_VERSION to $BASH_UTILS_VERSION ...\" \u0026\u0026 wget -q -O - \"https://api.github.com/repos/softspring/bash-utils/tarball/refs/tags/$BASH_UTILS_VERSION\" | tar -xz --strip-components=1 -C \"$UTILS_TMP_PATH\"\n#echo \"$BASH_UTILS_VERSION\" \u003e \"$UTILS_TMP_PATH/.version\"\n\n# load last commit of branch\nBRANCH=\"5.4\"\nBASH_UTILS_VERSION=$(curl -H \"Authorization: token $GITHUB_ACCESS_TOKEN\" -s https://api.github.com/repos/softspring/bash-utils/commits?sha=$BRANCH | grep 'sha' | head -n1 | sed -n 's/.*\"sha\": \"\\(.*\\)\".*/\\1/p' | tail -n2 | head -n1)\nCURRENT_VERSION=$(cat \"$UTILS_TMP_PATH/.version\" 2\u003e /dev/null || echo '')\n[ \"$CURRENT_VERSION\" != \"$BRANCH-$BASH_UTILS_VERSION\" ] \u0026\u0026 echo \"# Updating bash-utils from $CURRENT_VERSION to $BRANCH-$BASH_UTILS_VERSION ...\" \u0026\u0026 wget -q -O - \"https://github.com/softspring/bash-utils/archive/$BASH_UTILS_VERSION.tar.gz\" | tar -xz --strip-components=1 -C \"$UTILS_TMP_PATH\"\necho \"$BRANCH-$BASH_UTILS_VERSION\" \u003e \"$UTILS_TMP_PATH/.version\"\n\n# load code (new version sfs.sh, not project.sh to allow load commands from different locations)\nsource \"$UTILS_TMP_PATH/sfs.sh\"\n# load_dir \"$UTILS_TMP_PATH/docker-commands\"\n# load_dir \"$UTILS_TMP_PATH/symfony-commands\"\nload_dir \"$SCRIPTS_DIR\"\n#_debug_commands\nfind_command \"$@\"\nrun_command \"$@\"\nexit 0\n```\n\nMake it executable:\n\n```bash\nchmod +x project\n```\n\n**Script explanation:**\n\n- define `GITHUB_ACCESS_TOKEN` with your github token, to avoid rate limit\n- define `BASE_DIR` and `SCRIPTS_DIR` paths\n- maybe you will need to define `UTILS_TMP_PATH` to a hidden directory if you want to hide it\n- load last release of bash-utils (uncomment the lines) os use the last commit of a branch (comment the release lines and uncomment the branch lines)\n- load the code with `source \"$UTILS_TMP_PATH/sfs.sh\"`\n- load the commands from the directories: docker-commands, symfony-commands and scripts\n- find and run the command\n\n## Commands\n\nThere are some command groups that you can use:\n\n**Docker commands**\n\nIncludes a few commands to manage local environment with docker.\n\nImport them uncommenting the line `load_dir \"$UTILS_TMP_PATH/docker-commands\"` in the project file.\n\n```bash\nload_dir \"$UTILS_TMP_PATH/docker-commands\"\n```\n\nThis will load the following commands:\n\n- project config: to configure project\n- project start: to start the project\n- project stop: to stop the project\n- project open: to open the project\n\n**Symfony and dev commands**\n\nIncludes a few commands to manage symfony projects.\n\nImport them uncommenting the line `load_dir \"$UTILS_TMP_PATH/symfony-commands\"` in the project file.\n\n```bash\nload_dir \"$UTILS_TMP_PATH/symfony-commands\"\n```\n\nThis will load the following commands:\n\n- project clean: to clean the project caches\n- project composer: to run composer commands\n- project console: to run symfony console commands\n- project logs: to show docker logs\n- project migrations: to run migrations commands\n- project php: to run commands in php container\n- project yarn: to run commands in yarn container\n\n## Create a new command\n\nCreate a *example*.sh file into scripts directory:\n\n```bash\n#!/bin/bash -e\n\n# shellcheck disable=SC2034\nCOMMAND_NAME=\"example\"\nCOMMAND_HELP_DESCRIPTION=\"Creates an example\"\nCOMMAND_HELP_USAGE=\"project example\"\nCOMMAND_HELP_TEXT=\"\n  The ${ANSI_SUCCESS}project example${ANSI_END} script for this example.\n\n  Additional usage explanations\n\"\n\n[ -z \"${UTILS_TMP_PATH}\" ] \u0026\u0026 echo \"Run $COMMAND_NAME command with project script:\" \u0026\u0026 echo \"$ $COMMAND_HELP_USAGE\" \u0026\u0026 exit 1\n\nfunction run_example {\n  # GET ALL ARGUMENTS\n  # shellcheck disable=SC2124\n  local ARGUMENTS=\"${@:1}\"\n  \n  # or SPLIT THEM\n  local VARIABLE1=\"$1\"\n  local VARIABLE2=\"$2\"\n  \n  echo \"DO RUN COMMAND!!!\"\n}\n```\n\n## Functions\n\nAlso, a few functions are provided in several scripts.\n\n**Docker functions**\n\nSee functions/docker.sh\n\n**Env vars functions**\n\nSee functions/env.sh\n\n**File management functions**\n\nSee functions/files.sh\n\n**Google cloud functions**\n\nSee functions/gcloud.sh\n\n**Prompt functions**\n\nSee functions/prompt.sh\n\n**Text functions**\n\nSee functions/text.sh\n\n**Utils functions**\n\nSee functions/utils.sh\n\n**Yaml functions**\n\nSee functions/yaml.sh\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftspring%2Fbash-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftspring%2Fbash-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftspring%2Fbash-utils/lists"}