https://github.com/creemama/shellutil
POSIX-compliant shell scripting utility functions
https://github.com/creemama/shellutil
posix shell-scripting
Last synced: about 1 year ago
JSON representation
POSIX-compliant shell scripting utility functions
- Host: GitHub
- URL: https://github.com/creemama/shellutil
- Owner: creemama
- License: mit
- Created: 2020-11-22T05:20:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-22T21:27:21.000Z (about 3 years ago)
- Last Synced: 2025-01-22T02:47:34.981Z (over 1 year ago)
- Topics: posix, shell-scripting
- Language: Shell
- Homepage:
- Size: 59.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# shellutil.sh
> POSIX-compliant shell scripting utility functions
Include `shellutil.sh` as a
[submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) of your Git
repo by executing the following:
```
$ git submodule add https://github.com/creemama/shellutil
```
Use the [dot operator](https://ss64.com/bash/source.html) to include
`shellutil.sh` in one of your scripts:
```
#!/bin/sh
script_dir="$(
cd "$(dirname "$0")"
pwd -P
)"
cd "$script_dir"
if [ ! -f shellutil/shellutil.sh ]; then
git submodule update --init
fi
# shellcheck source=shellutil/shellutil.sh
. shellutil/shellutil.sh
# set -o xtrace
printf '%s%s%s' "$(tbold)" 'Hello world!' "$(treset)"
```
## Available Utility Functions
- `is_integer`
- `is_tty`
- `tbold`
- `tcyan`
- `tgray`
- `tgreen`
- `tred`
- `treset`
- `tyellow`
- `test_command_exists`