Chinaunix首页 | 论坛 | 博客
  • 博客访问: 249265
  • 博文数量: 61
  • 博客积分: 1370
  • 博客等级: 中尉
  • 技术积分: 452
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-04 23:40
文章分类

全部博文(61)

文章存档

2012年(1)

2011年(60)

我的朋友

分类: LINUX

2011-08-31 00:10:56

#!/bin/bash
# useradd1.sh - A simple shell script to display the form dialog
# set field names i.e. shell variables
shell=""
groups=""
user=""
home=""
tmd="/tmp/tmp.$$"
# open fd
#exec 3>&1
# Store data to $VALUES variable
dialog --ok-label "Submit" \
        --backtitle "Linux User Managment" \
        --title "Useradd" \
        --form "Create a new user" \
15 50 0 \
      "Username:" 1 1      "$user"       1 10 10 0 \
      "Shell:"    2 1      "$shell"        2 10 15 0 \
      "Group:"    3 1      "$groups"        3 10 8 0 \
      "HOME:"     4 1      "$home"       4 10 40 0  2>"${tmd}"
# close fd
#exec 3>&-
# display values just entered
#echo "$VALUES"
r=( $(cat $tmd |awk '{print $1,$2,$3,$3}'))
t1=${r[0]}
t2=${r[1]}
t3=${r[2]}
t4=${r[3]}
echo "t1:" $t1
echo "t2:" $t2
echo "t3:" $t3
echo "t4:" $t4


阅读(958) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~