adduser.sh
来自「Solaris环境下Shell编程编程」· Shell 代码 · 共 33 行
SH
33 行
#!/bin/sh# Purpose: To write a script to add user to the system.# Name: adduser### Set a shell variable to test the grep command.name=nuucp # Should match a single entry#name=uucp # Should match a single entry#name=root # Should match a single entry#name=rot # Should not match any entrygrep "^$name:" ./mypasswd# End of lab 4# Use nawk to extract all the UIDs into the temp file currentuidnawk -F: '{print $3}' ./mypasswd > ./currentuid# Use sed to remove all 1, 2, and 3 digit UIDs from currentuid, and# place the output in the temp file currentuid2sed -e '/^.$/d' -e '/^..$/d' -e '/^...$/d' ./currentuid > ./currentuid2# Use sed to remove UIDs 60001, 60002, and 65534 from currentuid2,# and place the output in the temp file currentuid3 sed -e '/^6000[12]$/d' -e '/^65534$/d' ./currentuid2 > ./currentuid3# End of lab 6
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?