This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/bash/module/util.sh

10 lines
291 B
Bash
Raw Normal View History

2023-11-23 00:13:51 +03:00
# Get the number of avaialble cores (threads).
2023-12-07 01:44:42 +03:00
function _core_count() {
2023-12-05 21:50:45 +03:00
cat /proc/cpuinfo | grep ^processor | wc -l
2023-11-23 00:13:51 +03:00
}
# Parse integers from mixed string.
function _parse_ints() {
echo "${*}" | tr '\n' ' ' | sed -e 's/[^0-9]/ /g' -e 's/^ *//g' -e 's/ *$//g' | tr -s ' ' | sed 's/ /\n/g'
}