📄 am-i-root.sh
字号:
#!/bin/bash# am-i-root.sh: Am I root or not?ROOT_UID=0 # Root has $UID 0.if [ "$UID" -eq "$ROOT_UID" ] # Will the real "root" please stand up?then echo "You are root."else echo "You are just an ordinary user (but mom loves you just the same)."fiexit 0# ============================================================= ## Code below will not execute, because the script already exited.# An alternate method of getting to the root of matters:ROOTUSER_NAME=rootusername=`id -nu` # Or... username=`whoami`if [ "$username" = "$ROOTUSER_NAME" ]then echo "Rooty, toot, toot. You are root."else echo "You are just a regular fella."fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -