Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cwchentw/shlibs
Tiny but Handy Aliases and Functions for Bourne Shell
https://github.com/cwchentw/shlibs
bash dotfiles linux posix shell-aliases shell-functions shell-script unix zsh
Last synced: about 7 hours ago
JSON representation
Tiny but Handy Aliases and Functions for Bourne Shell
- Host: GitHub
- URL: https://github.com/cwchentw/shlibs
- Owner: cwchentw
- Created: 2019-11-24T15:00:45.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T04:59:13.000Z (7 months ago)
- Last Synced: 2024-04-21T02:19:42.471Z (7 months ago)
- Topics: bash, dotfiles, linux, posix, shell-aliases, shell-functions, shell-script, unix, zsh
- Language: Shell
- Homepage:
- Size: 35.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# shlibs
Tiny but handy aliases and functions for Bourne shell compatible shell.
## Warning
Currently, **shlibs** intends for personal use only. The content of shlibs may change without warning. Use it at your own risk.
## Why shlibs?
Instead of setting personal configuration files like *.bashrc* or *.zshrc* each time when approaching a new Unix or Unix-like system, it is easier to write common aliases and functions in an external shell script, sourcing it as needed. Therefore, we wrote **shlibs** as common utilities across Unix or Unix systems.
Though **shlibs** is for personal use only, we keep it as general as possible, from which removing personal and private data. Hence, you may apply **shlibs** in your own machine.
## System Requirements
* A Bourne shell compatible shell
* Standard POSIX tools
* PerlWe tested shlibs against several Unix or Unix-like systems:
* Ubuntu LTS 20.04
* Rocky Linux 8.5
* openSUSE Leap 15.3
* macOS Big Sur
* FreeBSD 13.0It should work on other Unix or Unix-like systems as well.
## Usage
Load *shlibs/load.sh* to enable it:
```
$ . path/to/shlibs/load.sh
```Load *shlibs/unload.sh* to disable it:
```
$ . path/to/shlibs/unload.sh
```## Shell Functions in shlibs
* `download`: download something with either `wget(1)` or `curl(1)`
* `psquery`: query PID by text
* `trims`: use `perl(1)` to remove trailing spases in source
* `try`: try specific command multiple times### `try`
`repeat` is a reserved word in Bash. Therefore, we name our function `try`.
By default, `try` try specific command for 5 times:
```
$ try wget -c https://example.com/path/to/software-0.1.tar.gz
```You may try your command more or less times:
```
$ try 3 wget -c https://example.com/path/to/software-0.1.tar.gz
```You may try your command until it succeeds with `0` or `-1` times:
```
$ try -1 wget -c https://example.com/path/to/software-0.1.tar.gz
```## Shell Aliases in shlibs
* `ls -F --color=auto`
* `mv -i`
* `cp -i`
* `rm -i`
* `mkdir -p`## Variables
* Common console colors
## Copyright
Copyright (c) 2019-2021 ByteBard. Licensed under Apache 2.0