https://github.com/jd-apprentice/sh-to-bin-boilerplate
Create your binary's from shell scripts with shc 🔢
https://github.com/jd-apprentice/sh-to-bin-boilerplate
Last synced: 11 months ago
JSON representation
Create your binary's from shell scripts with shc 🔢
- Host: GitHub
- URL: https://github.com/jd-apprentice/sh-to-bin-boilerplate
- Owner: jd-apprentice
- License: mit
- Created: 2024-03-18T02:55:16.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-18T04:07:46.000Z (almost 2 years ago)
- Last Synced: 2025-02-02T12:15:01.771Z (about 1 year ago)
- Language: Shell
- Size: 36.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SH TO BIN Boilerplpate 📦

This repository is a boilerplate on how create your own binaries from shell scripts. Using shc, you can compile your shell scripts into binaries.
Logo from `http://www.patorjk.com/software/taag/#p=display&f=ANSI%20Regular&t=Sample%20App`
## Requirements 📋
- [shc](https://github.com/neurobin/shc)
- bash
## Build 📦
There is a makefile rule to build the binary.
```bash
make
```
## Execute 🔢
There is a makefile rule to execute the binary.
```bash
make execute
```
Once complete you can move the binary to `/usr/local/bin` to make it available system wide.
```bash
sudo mv build/sample_app /usr/local/bin
```
## Explanation on how add funcionality âž•
You can write functions with bash or write node/python scripts and call them from the main script.
To understand how to make a python or node script callable from the main script, you can check the `weather` and `dolar` functions.
Also read from `https://en.wikipedia.org/wiki/Shebang_%28Unix%29` to understand how to make a script executable.
To understand how the select works, you can read from `https://linuxize.com/post/bash-select/`
```bash
PS3='Select an option: '
# Add more options here
options=("Print message" "Weather" "Dolar" "Exit")
# Add your functions here
select opt in "${options[@]}"
do
case $opt in
"Print message")
first
break
;;
"Weather")
weather
break
;;
"Dolar")
dolar
break
;;
"Exit")
stop_app
break
;;
*) echo -e "Invalid option";;
esac
done
```