ls0398 发表于 2018-8-25 11:23:50

shell练习题2-linux运维

写一个脚本  
      添加10个用户user1到user10,但要求只有用户不存在的情况下才能添加
  

  
程序如下:
  
#!/bin/bash
  
for i in `seq 1 10`;do
  
cut -d: -f1 /etc/passwd |grep 'user$i' 2>>/tmp/etc.err || useradd user$i
  
done


页: [1]
查看完整版本: shell练习题2-linux运维