Code Monkey home page Code Monkey logo

bashframe's Introduction

BashFrame 1.0.1

Description

BashFrame is a bash script framework designed for creating and managing bash scripts. It offers a range of utility functions, from checking user privileges and verifying tool installations to downloading files and validating inputs. This script serves as a comprehensive template for your bash scripting needs.

Author Information

Ervis Tusha
GitHub
Twitter
LinkedIn
E-mail

Features

  1. Check user's sudo or root privileges.
  2. Determine if a specific tool is installed.
  3. Download files using wget, curl, or python.
  4. Validate inputs like emails, URLs, IPs, and MAC addresses.
  5. Log actions for easier debugging and monitoring.
  6. ... and several more utility functions!

List of Functions

Function Description
IS_SUDO Determine if the user has root or sudo privileges.
IS_INSTALLED Determine if a specific tool is installed.
DOWNLOAD Download files using wget, curl, or python.
INSTALL (Removed based on your previous request)
UNINSTALL Uninstall the script.
UPDATE Update the script to its latest version.
ASK_USER Interactively ask the user a question with a Yes/No response.
IS_EMPTY Check if a given variable is empty.
IS_NUMBER Check if a given variable is a numeric value.
IS_STRING Check if a given variable is a string.
VAL_EMAIL Check if a given value is a valid email address.
VAL_URL Check if a given value is a valid URL.
VAL_IP Check if a given value is a valid IPv4 address.
VAL_IPV6 Check if a given value is a valid IPv6 address.
VAL_MACADDR Check if a given value is a valid MAC address.
LOG Log messages to a specified log file.
CHECK_PERMISSIONS Check if file permissions match the expected permissions.
GENERATE_RANDOM Generate a random string based on specified criteria.
FILE_EXISTS Check if a specified file or directory exists.
DIR_EXISTS Check if a specified directory exists.
FILE_EMPTY Check if a specified file is empty.
DIR_EMPTY Check if a specified directory is empty.
IS_WRITABLE Check if a given file or directory is writable.
IS_READABLE Check if a given file or directory is readable.
IS_EXECUTABLE Check if a given file or directory is executable.
IS_OWNED_BY_USER Check if a given file or directory is owned by a specific user.
IS_OWNED_BY_GROUP Check if a given file or directory is owned by a specific group.
IS_OLDER_THAN Check if a file or directory is older than a specified number of days.
GET_PUBLIC_IP Retrieve the public IP address of the machine.
GET_LOCAL_IP Retrieve the local IP address of a specified interface.
STRING_LENGTH Determine the length of a given string.

How to Use

BashFrame offers a multitude of functions, each designed for a specific purpose. Here are some primary functions along with their usage examples:

  1. IS_SUDO: Determine if the user has root or sudo privileges.
    IS_SUDO && echo "User has root privileges"
  2. IS_INSTALLED: Determine if a specific tool is installed.
    IS_INSTALLED "wget" && echo "wget is installed"
  3. DOWNLOAD: Download a file using wget, curl, or python.
    DOWNLOAD "https://example.com/file.txt" "/tmp/file.txt"
  4. LOG: Log a message to a file.
    LOG "This is a log message"

LOGGING

Logs can be found in /tmp/log/[SCRIPT].log.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

For those interested in contributing, feel free to raise issues or make pull requests.

bashframe's People

Contributors

ervistusha avatar

Stargazers

 avatar

Watchers

 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.