general: Fix #38
This commit is contained in:
@@ -294,6 +294,8 @@ is_hex_color "$color" || color="#FFFFFF"
|
|||||||
|
|
||||||
## Split a string on a delimiter
|
## Split a string on a delimiter
|
||||||
|
|
||||||
|
**CAVEAT:** Requires `bash` 4+
|
||||||
|
|
||||||
This is an alternative to `cut`, `awk` and other tools.
|
This is an alternative to `cut`, `awk` and other tools.
|
||||||
|
|
||||||
**Example Function:**
|
**Example Function:**
|
||||||
|
|||||||
37
file
Normal file
37
file
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
-> Running tests on the Pure Bash Bible..
|
||||||
|
-----------------------------------------
|
||||||
|
[32m✔[m | bar
|
||||||
|
[32m✔[m | basename
|
||||||
|
[32m✔[m | count
|
||||||
|
[32m✔[m | cycle
|
||||||
|
[32m✔[m | date
|
||||||
|
[32m✔[m | dirname
|
||||||
|
[32m✔[m | extract
|
||||||
|
[32m✔[m | get_functions
|
||||||
|
[32m✔[m | head
|
||||||
|
[32m✔[m | hex_to_rgb
|
||||||
|
[32m✔[m | hex_to_rgb
|
||||||
|
[32m✔[m | lines
|
||||||
|
[32m✔[m | lines_loop
|
||||||
|
[32m✔[m | lower
|
||||||
|
[32m✔[m | lstrip
|
||||||
|
[32m✔[m | read_sleep
|
||||||
|
[32m✔[m | regex
|
||||||
|
[31m✖[m | remove_array_dups ("5 4 3 2 1" != "1 2 3 4 5")
|
||||||
|
[31m✖[m | reverse_array ("5 4 3 2 1 5 4 3 2 1" != "5 4 3 2 1")
|
||||||
|
[32m✔[m | rgb_to_hex
|
||||||
|
[32m✔[m | rstrip
|
||||||
|
[32m✔[m | split
|
||||||
|
[32m✔[m | strip
|
||||||
|
[32m✔[m | strip_all
|
||||||
|
[32m✔[m | tail
|
||||||
|
[32m✔[m | trim_all
|
||||||
|
[32m✔[m | trim_quotes
|
||||||
|
[32m✔[m | trim_string
|
||||||
|
[32m✔[m | upper
|
||||||
|
[32m✔[m | urldecode
|
||||||
|
[32m✔[m | urlencode
|
||||||
|
----------------------------------------
|
||||||
|
Completed 31 tests. 29 passed, 2 failed.
|
||||||
|
|
||||||
@@ -117,6 +117,8 @@ is_hex_color "$color" || color="#FFFFFF"
|
|||||||
|
|
||||||
## Split a string on a delimiter
|
## Split a string on a delimiter
|
||||||
|
|
||||||
|
**CAVEAT:** Requires `bash` 4+
|
||||||
|
|
||||||
This is an alternative to `cut`, `awk` and other tools.
|
This is an alternative to `cut`, `awk` and other tools.
|
||||||
|
|
||||||
**Example Function:**
|
**Example Function:**
|
||||||
@@ -315,6 +317,7 @@ The Quick Brown
|
|||||||
```sh
|
```sh
|
||||||
urlencode() {
|
urlencode() {
|
||||||
# Usage: urlencode "string"
|
# Usage: urlencode "string"
|
||||||
|
local LC_ALL=C
|
||||||
for (( i = 0; i < ${#1}; i++ )); do
|
for (( i = 0; i < ${#1}; i++ )); do
|
||||||
: "${1:i:1}"
|
: "${1:i:1}"
|
||||||
case "$_" in
|
case "$_" in
|
||||||
|
|||||||
Reference in New Issue
Block a user