Get the App
SLTechnology News&Howtos  ›  Servers  › 

Shell judges the user

Shulou Source: shulou.com Published: 2022-06-03 06:55:06 10月02日 Update

If [`whoami` = "XXX"]

Then

# echo "[user Detection ok] the current execution user is XXX and the script continues to execute"

Echo ""

Else

Echo "[user Detection fail] $kkk project deploys ERROR. The current user is `whoami` and must use XXX.

User execution, script exit execution! "

Exit 1

Fi

Tags: Users scripts tests projects Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi OPPO Reno NVidia Huawei