bash shell
红莲之殇
一个简单的iter
展开
-
创建SysV系统脚本(可指定运行级别自动启动)
/etc/rc.d/init.d /etc/init.d服务类脚本 sysV /etc/rc.d/init.d 必须有的选项: start stop restart statuschkconfig 脚本的前面必须有下面两行,如果没有 chkconfig命令检测不到此脚本 # chkconfig: runlevels SS KK原创 2016-04-17 19:37:42 · 1258 阅读 · 0 评论 -
shell小脚本
第一题 要求: 1. 设定变量FILE的值为/etc/passwd 2. 依次向/etc/passwd中的每个用户问好,并显示对方的shell,形如: hello, root, your shell: /bin/bash 3. 统计一共有多少用户#!/bin/bashFILE="/etc/passwd" context=`cat /etc/pa原创 2016-04-10 17:15:21 · 399 阅读 · 0 评论 -
脚本实现重新对一个磁盘分区格式化
主要分为三步 1. 删除原有分区 2. 使用fdisk进行分区 3. 创建文件系统#!/bin/bash # disks=$(fdisk -l 2>/dev/null |grep '^Disk /dev/[sh]d[a-z]' |awk -F: '{print $1}' |cut -d' ' -f2 |awk -F '/' '{print $3}' |tr '\n' ' ') reparti原创 2016-06-28 16:25:10 · 880 阅读 · 0 评论