「Shell」whoamiで実行ユーザの権限を確認するサンプル

2020年10月29日

説明
whoami ユーザー名を取得
サンプルコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/bin/bash
authuser=arkadmin
if [[ 'whoami' != "${authuser}" ]]
then
echo "user auth is not correct"
 exit 1
else
echo "run ok"
fi
#!/bin/bash authuser=arkadmin if [[ 'whoami' != "${authuser}" ]] then echo "user auth is not correct"  exit 1 else echo "run ok" fi
#!/bin/bash

authuser=arkadmin

if [[ 'whoami' != "${authuser}" ]]
then
  echo "user auth is not correct"
 exit 1
else 
  echo "run ok"
 fi

 

shellscript

Posted by arkgame