save point

This commit is contained in:
kake26 2024-06-10 20:55:40 -05:00
parent 38f475d045
commit 89f514ce60
Signed by: kake26
GPG key ID: E8AFC43591876B4D
3 changed files with 18 additions and 4 deletions

View file

@ -4,7 +4,7 @@ A framework for making bash scripts with some useful features
# The config scripts # The config scripts
One uses JQ the other awk,grep and sed. They basically achieve the same thing though to allow you to have a config file for a bash script. Good for keeping things like passwords and such out of the script itself. JQ is a external requirement that might need to be installed as to the where the others are likley already there. JQ runs on basically any platform, so its not a big issue. Even on my router so there is that. One uses JQ the other awk,grep and sed. They basically achieve the same thing though to allow you to have a config file for a bash script. Good for keeping things like passwords and such out of the script itself. JQ is a external requirement that might need to be installed as to the where the others are likley already there. JQ runs on basically any platform, so its not a big issue. Even on my router so there is that. These alone have no end of uses. Great for seperating out user names and passwords from code. I like to json and add config.json into .gitignore for any projects I open source using bash. Very useful.
# Where did the name come from? # Where did the name come from?

View file

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
# was split out to a seperate project, but will be pulled in when done
# check for curl # check for curl
if ! command -v curl &> /dev/null if ! command -v curl &> /dev/null

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
set -x #set -x
# a bash file that can provide various bits of info about the system # a bash file that can provide various bits of info about the system
function cpuinfo() { function cpuinfo() {
@ -26,7 +26,17 @@ function diskinfo() {
function networkinfo() { function networkinfo() {
echo "Network:" echo "Network:"
# We will get to this later # get network interfaces and usage
# get network adapters and usage
adapters=$(ip -s addr | grep -E '^[0-9]:' | awk -F ':' '{print $2}')
for adapter in $adapters; do
rx=$(ip -s link show $adapter | awk '/RX:/ {print $2}')
tx=$(ip -s link show $adapter | awk '/TX:/ {print $2}')
echo -e "$adapter\tRX: $rx\tTX: $tx"
done
} }
@ -34,3 +44,5 @@ function networkinfo() {
cpuinfo cpuinfo
meminfo meminfo
diskinfo
networkinfo