- Shell 100%
| coin | Adds scripts. | |
| colors | Removes trailing newline. | |
| crypto | Adds scripts. | |
| example | Adds scripts. | |
| filter | Adds script. | |
| LICENSE | Initial commit | |
| README.md | Fixes append logic. | |
| rn | Adds scripts. | |
| search | Simplifies regex logic. | |
| stats | Adds better output formatting and audio device levels. | |
| substitute | Adds script. | |
| url | Adds scripts. | |
| venv | Adds scripts. | |
| weather | Adds scripts. | |
Overview
These scripts are written in Bash, but involve tools such as cURL and GNU Core Utilities, which should be a low enough dependency footprint to work on both MacOS and Linux systems. Each script's purpose is commented directly in the source code.
How to use
Most of these scripts support an optional input argument. They can be acquired and invoked in a few different ways that will be outlined below. Note that any instance of <script> refers to the name of the script, which is meant to be replaced at runtime.
Download altogether
With git:
git clone https://codeberg.org/VFX/Bash-Scripts.git
Without git:
curl -Os https://codeberg.org/VFX/Bash-Scripts/archive/main.zip
unzip -q ${_##*/} && rm $_
Download individually
curl -Os https://codeberg.org/VFX/Bash-Scripts/raw/branch/main/<script>
Run in place
bash <script> <argument>
Integrated execution
There are a few options to invoke as a command without needing to enter or specify the path.
Add to $PATH
The files are not created with executable permissions. To make them executable, run
chmod +x <script>
Then, add the script to $PATH by placing it in one of the directories listed from running echo $PATH, which can be performed graphically or by running mv <script> <directory>
They can also be added to .bashrc as functions for the same effect.
Add to .bashrc individually
These scripts are simple enough to be stored as functions, which could be used to consolidate them into a single file. To do this, follow this syntax while excluding the shebang (#!/usr/bin/env bash)
<script>() {
<place all code here>
}
Add to .bashrc altogether
Running the following code will append all code in this repository as functions to ~/.bashrc.
curl -Os https://codeberg.org/VFX/Bash-Scripts/archive/main.zip
unzip -q ${_##*/} && rm $_
cp ~/.bashrc{,.bak}
for file in bash-scripts/*; do
if [[ $(< "${file}") =~ ^'#!/usr/bin/env bash' ]]
then mapfile -s 2 script < "${file}"
printf '%b' "\n${file##*/}() {\n${script[@]}\n}\n" >> ~/.bashrc
fi
done
rm -r bash-scripts
Remote execution
Warning: this method is not considered a safe practice, but is included for educational purposes.
curl -s https://codeberg.org/VFX/Bash-Scripts/raw/branch/main/<script> | bash -s <argument>