#!/bin/bash

read -p "please input a username:" username

if id -u $username >/dev/null 2>&1; then
        echo "user exists"
else
        echo "user does not exist"
fi

把上面内存保存为 test.sh , 然后 sh test.sh 运行

linux 判断一个用户是否存在   _fei

相关文章:

  • 2022-12-23
  • 2021-09-11
  • 2021-06-01
  • 2022-12-23
  • 2022-02-02
  • 2022-01-04
  • 2022-12-23
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2021-09-26
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2022-03-09
  • 2022-12-23
相关资源
相似解决方案