add functions osinfo adduserid () fsudo () to basic

master
Kebler Network System Administrator 2022-10-24 18:13:58 -07:00
parent 10fb48069b
commit 78ef8d0a88
1 changed files with 22 additions and 1 deletions

View File

@ -86,4 +86,25 @@ editor() { ${EDITOR} $1; }
add-repo-key () {
gpg --keyserver keyserver.ubuntu.com --recv-key $1
gpg -a --export $1 | sudo apt-key add -
}
}
osinfo () {
echo kernel: $(uname -r)
echo machine: $(arch)
cat /etc/os-release
cat /etc/upstream-release/lsb-release
}
# adduserid name id#
# add a suer with specific id number
adduserid () {
sudo groupadd -g $2 $1
sudo useradd -d ${/home/$1} -s /bin/bash -u $2 -g $1 $1
}
fsudo () # run a function as sudo
{
[[ "$(type -t $1)" == "function" ]] &&
ARGS="$@" && sudo bash -c "$(declare -f $1); $ARGS"
}
alias ssudo="ssudo "