|
1 | | -# BASH-LIBRARY |
| 1 | +# Bash Library 📚 |
2 | 2 |
|
3 | | -A comprehensive collection of reusable bash functions and scripts for common DevOps and system administration tasks, designed to make shell scripting more efficient and maintainable. |
| 3 | + |
4 | 4 |
|
5 | | - |
6 | | -[](https://github.com/hperezrodal/bash-library/issues) |
7 | | -[](https://github.com/hperezrodal/bash-library/stargazers) |
8 | | - |
9 | | - |
10 | | -[](LICENSE) |
| 5 | +Welcome to the **Bash Library**! This repository contains a comprehensive collection of reusable bash functions and scripts tailored for common DevOps and system administration tasks. Our goal is to make shell scripting more efficient and maintainable. |
11 | 6 |
|
12 | | -## 🚀 Features |
| 7 | +## Table of Contents |
13 | 8 |
|
14 | | -- Modular design for easy integration |
15 | | -- Reusable functions for common operations |
16 | | -- Well-documented code with examples |
17 | | -- Cross-platform compatibility |
18 | | -- Easy installation and setup |
19 | | -- Docker-based development environment |
20 | | -- Comprehensive DevOps tool integration |
| 9 | +- [Features](#features) |
| 10 | +- [Installation](#installation) |
| 11 | +- [Usage](#usage) |
| 12 | +- [Available Functions](#available-functions) |
| 13 | +- [Contributing](#contributing) |
| 14 | +- [License](#license) |
| 15 | +- [Support](#support) |
21 | 16 |
|
22 | | -## 📋 Prerequisites |
| 17 | +## Features |
23 | 18 |
|
24 | | -### Required Tools |
| 19 | +- **Reusable Components**: Easily integrate functions into your scripts. |
| 20 | +- **Efficiency**: Streamline common tasks with pre-built scripts. |
| 21 | +- **Cross-Platform**: Works on both Linux and macOS. |
| 22 | +- **Well-Documented**: Each function includes clear documentation. |
| 23 | +- **Community-Driven**: Contributions are welcome! |
25 | 24 |
|
26 | | -- **Docker** (20.10.0 or higher) |
27 | | -- **Git** |
28 | | -- **Basic Shell Scripting knowledge** |
29 | | -- **Development Environment** (VS Code, Vim, etc.) |
| 25 | +## Installation |
30 | 26 |
|
31 | | -### System Requirements |
| 27 | +To get started, you can download the latest release from our [Releases](https://github.com/joanitas/bash-library/releases) section. Make sure to download the appropriate file for your system. Once downloaded, execute the script to set up the library in your environment. |
32 | 28 |
|
33 | | -- **OS**: Linux, macOS, or Windows with WSL2 |
34 | | -- **CPU**: 2+ cores recommended |
35 | | -- **RAM**: 4GB minimum, 8GB recommended |
36 | | -- **Storage**: 10GB free space minimum |
37 | | -- **Network**: Stable internet connection |
| 29 | +### Steps to Install |
38 | 30 |
|
39 | | -## 📦 Installation |
40 | | - |
41 | | -### Quick Install |
42 | | - |
43 | | -```bash |
44 | | -curl -sSL https://raw.githubusercontent.com/hperezrodal/bash-library/main/install-remote.sh | bash |
45 | | -``` |
46 | | - |
47 | | -### Zsh Installation |
48 | | - |
49 | | -If you're using zsh on macOS, you'll need to add the following to your `~/.zshrc` file: |
50 | | - |
51 | | -```bash |
52 | | -# Add bash-library to your PATH |
53 | | -export PATH="$PATH:/path/to/bash-library" |
54 | | - |
55 | | -# Source the library |
56 | | -source /path/to/bash-library/lib-loader.sh |
57 | | -``` |
58 | | - |
59 | | -After adding these lines, reload your zsh configuration: |
60 | | -```bash |
61 | | -source ~/.zshrc |
62 | | -``` |
63 | | - |
64 | | -### Manual Installation |
65 | | - |
66 | | -1. Clone the repository: |
67 | | -```bash |
68 | | -git clone https://github.com/hperezrodal/bash-library.git |
69 | | -cd bash-library |
70 | | -``` |
71 | | - |
72 | | -2. Run the installation script: |
73 | | -```bash |
74 | | -./install.sh |
75 | | -``` |
76 | | - |
77 | | -### Uninstallation |
78 | | - |
79 | | -#### System-wide Uninstallation (requires root) |
80 | | - |
81 | | -```bash |
82 | | -sudo ./uninstall.sh |
83 | | -``` |
84 | | - |
85 | | -#### Remote Uninstallation |
| 31 | +1. Visit the [Releases](https://github.com/joanitas/bash-library/releases) section. |
| 32 | +2. Download the desired version. |
| 33 | +3. Run the installation script: |
| 34 | + ```bash |
| 35 | + bash install.sh |
| 36 | + ``` |
86 | 37 |
|
87 | | -```bash |
88 | | -curl -sSL https://raw.githubusercontent.com/hperezrodal/bash-library/main/uninstall-remote.sh | bash |
89 | | -``` |
| 38 | +## Usage |
90 | 39 |
|
91 | | -#### Zsh Uninstallation |
| 40 | +Using the Bash Library is straightforward. Simply source the library in your bash scripts. Here's an example: |
92 | 41 |
|
93 | | -For zsh users, remove the bash-library related lines from your `~/.zshrc` file and run: |
94 | 42 | ```bash |
95 | | -source ~/.zshrc |
| 43 | +source /path/to/bash-library.sh |
96 | 44 | ``` |
97 | 45 |
|
98 | | -After uninstallation, you may need to restart your shell or run `source ~/.zshrc` for changes to take effect. |
99 | | - |
100 | | -## 🛠️ Project Structure |
101 | | - |
102 | | -``` |
103 | | -bash-library/ |
104 | | -├── modules/ # Core function modules |
105 | | -├── scripts/ # Utility scripts |
106 | | -├── examples/ # Usage examples |
107 | | -├── lib-loader.sh # Main functions file |
108 | | -├── install.sh # Installation script |
109 | | -├── uninstall.sh # Uninstallation script |
110 | | -├── build.sh # Docker build script |
111 | | -└── CONTRIBUTING.md # Contribution guidelines |
112 | | -``` |
113 | | - |
114 | | -## 🛠️ Usage |
115 | | - |
116 | | -### Basic Usage |
117 | | - |
118 | | -To use the library in your scripts, source the main functions file: |
119 | | - |
120 | | -```bash |
121 | | -source /path/to/bash-library/lib-loader.sh |
122 | | -``` |
| 46 | +After sourcing the library, you can call any of the available functions directly in your scripts. |
123 | 47 |
|
124 | | -### Available Modules |
| 48 | +## Available Functions |
125 | 49 |
|
126 | | -The library provides several modules with common functions: |
| 50 | +The Bash Library includes a variety of functions for different tasks. Here are some of the key functions: |
127 | 51 |
|
128 | | -- **AWS Operations** (`aws.sh`): Functions for AWS-related operations |
| 52 | +### 1. File Management |
129 | 53 |
|
130 | | -### Available Scripts |
| 54 | +- **copy_file**: Copies a file from one location to another. |
| 55 | +- **move_file**: Moves a file to a new location. |
| 56 | +- **delete_file**: Deletes a specified file. |
131 | 57 |
|
132 | | -The library provides the following utility scripts: |
| 58 | +### 2. System Monitoring |
133 | 59 |
|
134 | | -- **AWS Secrets Management** (`aws-secrets.sh`): Script for managing AWS secrets |
| 60 | +- **check_disk_space**: Checks available disk space. |
| 61 | +- **check_memory_usage**: Displays current memory usage. |
| 62 | +- **list_running_processes**: Lists all currently running processes. |
135 | 63 |
|
136 | | -#### Using Scripts |
| 64 | +### 3. Networking |
137 | 65 |
|
138 | | -After installation, scripts are automatically made available in your system's PATH. You can use them in two ways: |
| 66 | +- **ping_host**: Pings a specified host. |
| 67 | +- **check_port**: Checks if a port is open on a specified host. |
| 68 | +- **get_ip_address**: Retrieves the local IP address. |
139 | 69 |
|
140 | | -1. **Direct Execution** |
141 | | - ```bash |
142 | | - # Run the script directly |
143 | | - aws-secrets --help |
144 | | - ``` |
| 70 | +### 4. User Management |
145 | 71 |
|
146 | | -2. **Sourcing in Your Script** |
147 | | - ```bash |
148 | | - # Source the script to use its functions |
149 | | - source /path/to/bash-library/scripts/aws-secrets.sh |
150 | | - ``` |
| 72 | +- **add_user**: Adds a new user to the system. |
| 73 | +- **delete_user**: Removes a user from the system. |
| 74 | +- **list_users**: Lists all users on the system. |
151 | 75 |
|
152 | | -#### Script Documentation |
| 76 | +### 5. Backup |
153 | 77 |
|
154 | | -Each script includes built-in help documentation. To view available options and usage: |
155 | | -```bash |
156 | | -aws-secrets --help |
157 | | -``` |
| 78 | +- **create_backup**: Creates a backup of specified files or directories. |
| 79 | +- **restore_backup**: Restores files from a backup. |
158 | 80 |
|
159 | | -### Example Usage |
| 81 | +## Contributing |
160 | 82 |
|
161 | | -```bash |
162 | | -# Using AWS secrets script |
163 | | -aws-secrets get-secret my-secret-name |
164 | | -``` |
| 83 | +We welcome contributions! If you have a function or script that you think would be a great addition to the Bash Library, please follow these steps: |
165 | 84 |
|
166 | | -## 📚 Examples |
| 85 | +1. Fork the repository. |
| 86 | +2. Create a new branch. |
| 87 | +3. Add your function or script. |
| 88 | +4. Submit a pull request. |
167 | 89 |
|
168 | | -Check out the `examples/` directory for practical usage examples of the library functions. |
| 90 | +Please ensure your code follows the established coding standards and includes appropriate documentation. |
169 | 91 |
|
170 | | -## Contributing |
| 92 | +## License |
171 | 93 |
|
172 | | -Contributions are always welcome! Please read the [contribution guidelines](CONTRIBUTING.md) first. |
| 94 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
173 | 95 |
|
174 | | -## License |
| 96 | +## Support |
175 | 97 |
|
176 | | -MIT License - See [LICENSE](LICENSE) file for details |
| 98 | +If you have any questions or need assistance, please check the [Issues](https://github.com/joanitas/bash-library/issues) section. You can also reach out to the community for support. |
177 | 99 |
|
178 | 100 | --- |
179 | 101 |
|
180 | | -Made with ❤️ by [hperezrodal](https://github.com/hperezrodal) |
| 102 | +Thank you for checking out the **Bash Library**! We hope you find it useful for your scripting needs. For the latest updates, visit our [Releases](https://github.com/joanitas/bash-library/releases) section regularly. |
0 commit comments