linux - 使用 mac 地址验证运行 Shell 脚本

标签 linux shell mac-address

我们可以运行 shell 脚本来检查系统 MAC 地址验证然后进行处理吗?

#!/bin/bash

### here i need to check system mac address 
### if mac is not match then script will not run
killall gnome-terminal
echo "End Of Day Session Complete"

请提出建议

最佳答案

为什么不呢。首先获取系统的 mac 地址,并将其存储在 shell 脚本或配置文件的变量中。每次运行脚本时,首先获取系统的mac地址,并与已存储在脚本变量中的mac id进行比较,如果相同则继续,否则退出。使用 ifconfig -a 命令获取系统的 MAC 地址并将其存储在配置文件或脚本中。

关于linux - 使用 mac 地址验证运行 Shell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49172457/

相关文章:

linux - 在线根据txt文件中的文件名查找并移动文件

c++ - Linux C++ 中的页面对齐内存分配

linux - 从调试器隐藏系统调用

java - 如何将字符串 Mac 地址转换为字节数组

c++ - 使用参数从 C++ 程序调用 shell 脚本

linux - sendmail 发送没有空行的长消息

shell - 为什么 "(echo <Payload> && cat) | nc <link> <port>"会创建持久连接?

linux - 执行命令的 if 语句的实际值是多少?

linux - 使用shell脚本获取MAC地址

php - 是否有用于从 MAC 地址查找供应商的 PHP 库?