idcheck
来自「UNIX+shell范例精解(第4版)代码」· 代码 · 共 16 行
TXT
16 行
#!/bin/sh# Scriptname: idcheck# purpose:check user ID to see if user is root.# Only root has a uid of 0.# Format for id output:uid=9496(ellie) gid=40 groups=40# root's uid=0 id=`id | nawk -F'[=(]' '{print $2}'` # Get user IDecho your user id is: $idif [ $id -eq 0 ]then echo "you are superuser."else echo "you are not superuser."fi
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?