Coder Social home page Coder Social logo

enpihub / bash-config Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brbsix/bash-config

0.0 0.0 0.0 23 KB

Use configuration files with your bash scripts. Options to support several types of config files (bash, ini, or custom). Great for integrating with your own shell scripts on Linux and Android.

License: GNU General Public License v3.0

Shell 100.00%

bash-config's Introduction

bash-config

Bash script to interact with configuration files. Great for easily implementing basic config files in all of your Android, Linux, or OSX shell scripts.

Features

  • read/write/delete parameters with values
  • create and delete config files
  • autodetection of config style (between Bash and ini)
  • options for different styles of config files
    • Bash-style
    • Window's ini-style
    • use custom delimeter

Linux Installation

To install bash-config on Linux:

sudo install bash-config /usr/local/bin

Android Installation

This script was originally written for Bash but now supports Android's default shell mksh as well.

The only external tools used by bash-config are grep and sed. If you are missing either of these then you should install busybox.

Assuming you can download or otherwise transfer bash-config onto your phone, here are the installation instructions:

su
cp bash-config /data/local/bin
sed -i 's:#!/bin/bash:#!/system/bin/mksh:' /data/local/bin/bash-config  # update the shebang for Android's default shell
chmod 0755 /data/local/bin/bash-config

NOTE: You may need to add /data/local/bin to your PATH. This involves editing your shell's rc file. If you are using the default mksh shell, it is located at /system/etc/mkshrc. For Bash, it is most likely at /system/etc/bash/bashrc. Append the following to the end of the file:

export PATH="$PATH:/data/local/bin"

Usage

When accessing values, the config style is autodetected. When storing a value in a new file, it defaults to Bash-style (i.e. PARAMETER=value).

To create the first entry in an ini-style file (i.e. PARAMETER = value):

bash-config --ini FILE parameter value

To use a custom separator (i.e. PARAMETER:value) for read and write operations:

bash-config --custom : FILE parameter value

To access parameter value:

bash-config FILE parameter

To delete parameter:

bash-config FILE parameter %

To delete config file:

bash-config FILE %

License

Copyright (c) 2015 Six ([email protected]).

Licensed under the GPLv3 license.

bash-config's People

Contributors

brbsix avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.