Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@renault-digital/bash-base

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@renault-digital/bash-base

A common lib for creating bash script easily.

  • 1.6.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Welcome to bash-base

License GitHub top language codecov GitHub Actions Status Conventional Commits semantic-release GitHub release npm package Docker Cloud Build Status GitHub commits since latest release

Goal

No more spending time searching the special ways of bash for basic operations like "how to replace a string in bash", then compare, choose, and test among many potential solutions.

Bash-base does this for you, you can just call the function here which is well tested and stable, and only focus you on the high level logic. Writing your script with less time, but more readability.

Quick start

Creat a sample script example_docker.sh with the following content:

#!/usr/bin/env bash

source <(docker run renaultdigital/bash-base)

SHORT_DESC='an example shell script to show how to use bash-base '

args_parse $# "$@" firstName age sex country
args_valid_or_read firstName '^[A-Za-z ]{2,}$' "Your first name (only letters)"
args_valid_or_read age '^[0-9]{1,2}$' "Your age (maxim 2 digits))"
args_valid_or_select_pipe sex 'Mr.|Mrs' "Your sex"

response=$(curl -sS 'https://restcountries.eu/rest/v2/regionalbloc/eu' --compressed)
string_pick_to_array '{"name":"' '","topLevelDomain' countryNames "$response"
args_valid_or_select country countryNames "Which country"

print_success "Hello $sex $(string_upper_first "$firstName"), you are in $country, and your age is $age, nice to meet you."

Assign the execute right to it:

chmod +x example_docker.sh

Print the generated help usage with the option -h: help.gif

Run it: run.gif

Available on github, npm and dockerhub, see other ways of usage.

Example

See example folder

Reference

See reference

Specification

See spec folder

Latest Update

See CHANGELOG.md

Contributing

See How to contribute

License

MIT.

Keywords

FAQs

Package last updated on 09 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc