add functions osinfo adduserid () fsudo () to basic
parent
10fb48069b
commit
78ef8d0a88
|
@ -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 "
|
Loading…
Reference in New Issue