aks / bash-lib Goto Github PK
View Code? Open in Web Editor NEWLibrary of bash scripts
Home Page: http://aks.github.io/bash-lib/
License: MIT License
Library of bash scripts
Home Page: http://aks.github.io/bash-lib/
License: MIT License
Can you add a license file? I am interested in this repository.
my-new-script
It should be possible to add a string to a list without having the string evaluated.
There may be some use cases where the string should be eval'ed, but the default should be "as-is".
If someone really wants the string to be eval'ed before adding, just do this:
add_list somelist `eval "some string with $var"`
It should be possible to test the test utilities.
I cloned the repo, then tried to run make as described in the install instructions.
ass-vm vagrant master ~ bash-lib make
generate-prompt-colors
make: /usr/local/bin/bash: Command not found
Makefile:38: recipe for target 'prompt-colors.sh' failed
make: *** [prompt-colors.sh] Error 127
It should be possible to manage the dependencies when scripts source each other.
The check_output
function is already implemented. It shouldn't be that difficult to base check_out
and check_err
on it.
After one sorts out the installation troubles, many tests are failing: replit. This doesn't seem to just affect artificial scenarios, but for instance split_into()
fails miserably on my first try by not finding the __split_str()
function (which doesn't seem to exist).
Hi,
I tried to build and install the library and make failed because of the below call to generate-prompt-colors
. After making the below change make worked fine.
diff --git a/Makefile b/Makefile
index 0fd0e5b..9518f7b 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,7 @@ libs = \
# end of list
prompt-colors.sh: generate-prompt-colors
- generate-prompt-colors
+ ./generate-prompt-colors
clean::
rm -f prompt-colors.sh*
could not find this function in list-utils.sh
function array_indexof() {
[ $# -lt 2 ] && return 1
local a=("$@")
local v="${a[-1]}"
unset a[-1]
local i
for i in ${!a[@]}; do
if [ "${a[$i]}" = "$v" ]; then
echo $i
return 0 # stop after first match
fi
done
return 1
}
a=(1 2 3 4)
i=$(array_indexof "${a[@]}" 3)
echo $i # 2
also posted on https://stackoverflow.com/a/70793702/10440128
similar:
// javascript
[1,2,3,4].indexOf(3) == 2
# python
[1,2,3,4].index(3) == 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.