https://github.com/ozh/yourls-bash
Simple bash script to shorten URLs with YOURLS
https://github.com/ozh/yourls-bash
bash command-line-tool yourls yourls-api yourls-extension
Last synced: 5 days ago
JSON representation
Simple bash script to shorten URLs with YOURLS
- Host: GitHub
- URL: https://github.com/ozh/yourls-bash
- Owner: ozh
- License: mit
- Created: 2021-06-06T15:28:34.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-16T11:29:03.000Z (over 3 years ago)
- Last Synced: 2025-04-11T18:05:59.598Z (5 days ago)
- Topics: bash, command-line-tool, yourls, yourls-api, yourls-extension
- Language: Shell
- Homepage:
- Size: 3.91 KB
- Stars: 13
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - YOURLS BASH - a simple BASH script to shorten URLs with YOURLS. (Integrations / 3rd party Integrations and Frameworks)
README
# YOURLS BASH [](https://github.com/YOURLS/awesome-yourls/)
A simple bash script to shorten URLs with [YOURLS](https://yourls.org)
## Installation
```shell
# using wget
$> wget -q https://raw.githubusercontent.com/ozh/yourls-bash/master/yourls
# using curl
$> curl -s -o yourls https://raw.githubusercontent.com/ozh/yourls-bash/master/yourls
```Then, edit the two parameters at the beginning of the script (`YOURLS_HOST` and `YOURLS_KEY`) to match your setup.
Depending on your setup, you may want to make this file executable (`chmod +x yourls`) and in your $PATH (eg `~/bin` maybe)
## Usage
Shorten a long URL :
```bash
$> yourls https://someverylongdomain.com
https://sho.rt/ef
```Shorten a long URL and provide a custom keyword and a custom title :
```bash
$> yourls https://someverylongurl.com -k test12 --title "Some title"
https://sho.rt/test12
```Shorten a URL and receive JSON output, for instance to display with `jq` :
```bash
$> yourls https://example.com -f json | jq
{
"url": {
"keyword": "Nzs",
"url": "https://example.com",
"title": "Example Domain",
"date": "2021-06-06 16:03:44",
"ip": "127.0.0.1"
},
"status": "success",
"message": "http://example.com added to database",
"title": "Example Domain",
"shorturl": "http://sho.rt/Nzs",
"statusCode": 200
}
```Display help message :
```bash
$> yourls --help
```## License
Do whatever the hell you want with it