tl-setup/util.sh

30 lines
387 B
Bash
Executable File

#!/bin/sh
is_substring() {
case $2 in
*$1*)
return 0
;;
*)
return 1
;;
esac
}
fail() {
# TODO: make this exit cleanly, and from any subshell
echo "Something went wrong, exiting..."
exit
}
find_key_file() {
search_dir="$1"
for file in "$search_dir"/*
do
if cat "$file" | head -n1 | grep -q -- '-----BEGIN .* PRIVATE KEY-----'
then
echo "$file"
fi
done
}