「Shell」whoamiで実行ユーザの権限を確認するサンプル
説明
whoami ユーザー名を取得
サンプルコード
#!/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