misc: cleanup
This commit is contained in:
19
README.md
19
README.md
@@ -17,24 +17,11 @@ src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
|
||||
<img src="https://s3.amazonaws.com/titlepages.leanpub.com/bash/hero" width="40%" align="right">
|
||||
</a>
|
||||
|
||||
The goal of this book is to document known and unknown methods of
|
||||
doing various tasks using only built-in `bash` features. Using the snippets
|
||||
from this bible can help to remove unneeded dependencies from scripts
|
||||
and in most cases make them that little bit faster. I came across these
|
||||
tips and discovered a few while developing
|
||||
[neofetch](https://github.com/dylanaraps/neofetch),
|
||||
[pxltrm](https://github.com/dylanaraps/pxltrm) and some other smaller
|
||||
projects.
|
||||
The goal of this book is to document known and unknown methods of doing various tasks using only built-in `bash` features. Using the snippets from this bible can help to remove unneeded dependencies from scripts and in most cases make them that little bit faster. I came across these tips and discovered a few while developing [neofetch](https://github.com/dylanaraps/neofetch), [pxltrm](https://github.com/dylanaraps/pxltrm) and some other smaller projects.
|
||||
|
||||
The snippets below are linted using `shellcheck` and tests have been
|
||||
written where applicable. Want to contribute? Have a read of
|
||||
the
|
||||
[CONTRIBUTING.md](https://github.com/dylanaraps/pure-bash-bible/blob/master/CONTRIBUTING.md).
|
||||
It outlines how the unit tests work and what is required when adding
|
||||
snippets to the bible.
|
||||
The snippets below are linted using `shellcheck` and tests have been written where applicable. Want to contribute? Have a read of the [CONTRIBUTING.md](https://github.com/dylanaraps/pure-bash-bible/blob/master/CONTRIBUTING.md). It outlines how the unit tests work and what is required when adding snippets to the bible.
|
||||
|
||||
See something that is incorrectly described, buggy or outright
|
||||
wrong? Open an issue or send a pull request. If the bible is missing something, open an issue and a solution will be found.
|
||||
See something that is incorrectly described, buggy or outright wrong? Open an issue or send a pull request. If the bible is missing something, open an issue and a solution will be found.
|
||||
|
||||
<br>
|
||||
<p align="center"><b>This book is also available to purchase on leanpub. https://leanpub.com/bash</b></p>
|
||||
|
||||
7
test.sh
7
test.sh
@@ -74,28 +74,24 @@ test_head() {
|
||||
printf '%s\n%s\n\n\n' "hello" "world" > test_file
|
||||
result="$(head 2 test_file)"
|
||||
assert_equals "$result" $'hello\nworld'
|
||||
rm test_file
|
||||
}
|
||||
|
||||
test_tail() {
|
||||
printf '\n\n\n%s\n%s\n' "hello" "world" > test_file
|
||||
result="$(tail 2 test_file)"
|
||||
assert_equals "$result" $'hello\nworld'
|
||||
rm test_file
|
||||
}
|
||||
|
||||
test_lines() {
|
||||
printf '\n\n\n\n\n\n\n\n' > test_file
|
||||
result="$(lines test_file)"
|
||||
assert_equals "$result" "8"
|
||||
rm test_file
|
||||
}
|
||||
|
||||
test_lines_loop() {
|
||||
printf '\n\n\n\n\n\n\n\n' > test_file
|
||||
result="$(lines_loop test_file)"
|
||||
assert_equals "$result" "8"
|
||||
rm test_file
|
||||
}
|
||||
|
||||
test_count() {
|
||||
@@ -148,7 +144,6 @@ test_extract() {
|
||||
printf '{\nhello, world\n}\n' > test_file
|
||||
result="$(extract test_file "{" "}")"
|
||||
assert_equals "$result" "hello, world"
|
||||
rm test_file
|
||||
}
|
||||
|
||||
test_split() {
|
||||
@@ -170,7 +165,7 @@ assert_equals() {
|
||||
}
|
||||
|
||||
main() {
|
||||
trap 'rm readme_code' EXIT
|
||||
trap 'rm readme_code test_file' EXIT
|
||||
|
||||
# Extract code blocks from the README.
|
||||
while IFS=$'\n' read -r line; do
|
||||
|
||||
Reference in New Issue
Block a user