vim编辑器作业

1、复制/etc/profile至/tmp/目录,用查找替换命令删除/tmp/profile文件中的行首的空白字符
[root@wzc tmp]# vim profile 
 
# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"  
else        
. "$i" >/dev/null
fi          
fi              
done        
    
unset i
unset -f pathmunge
###:%s/^[[:space:]]\+//g  命令
2、复制/etc/rc.d/init.d/functions文件至/tmp目录,用查找替换命令为/tmp/functions的每行开头为空白字符的行的行首添加一个
#           
#           
#       
#       
#   
}
# A sed expression to filter out the files that is_ignored_file recognizes
__sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
if [ "$_use_systemctl" = "1" ]; then
#       
#               
#               
#               
#               
#               
#               
#               
#               
#       
fi
####:%s/^[[:space:]]\+.*/#/g  命令
3、如何设置tab缩进为4个字符?
160            shift 2
161            ;;  
162         --check=?*)
163                base=${1#--check=}
164            gotbase="yes"
165            shift
166            ;;  
167         --user)
168            user=$2
169            shift 2
170            ;;  
171         --user=?*)
172                user=${1#--user=}
173            shift
174            ;;  
175         --pidfile)
176            pid_file=$2
177            shift 2
178            ;;  
179         --pidfile=?*)
180            pid_file=${1#--pidfile=}
181            shift
182            ;;  
###:set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab nu autoindent cindent  命令
4、复制/etc/rc.d/init.d/functions文件至/tmp目录;替换/tmp/functions文件中的/etc/sysconfig/init为/var/log;
# Read in our configuration
if [ -z "${BOOTUP:-}" ]; then
  if [ -f /var/log ]; then
      . /var/log
  else
    # This all seem confusing? Look in /var/log,
    # or in /usr/share/doc/initscripts-*/sysconfig.txt
    BOOTUP=color
    RES_COL=60
    MOVE_TO_COL="echo -en \\033[${RES_COL}G"
    SETCOLOR_SUCCESS="echo -en \\033[1;32m"
    SETCOLOR_FAILURE="echo -en \\033[1;31m"
    SETCOLOR_WARNING="echo -en \\033[1;33m"
    SETCOLOR_NORMAL="echo -en \\033[0;39m"
    LOGLEVEL=1
  fi
  if [ "$CONSOLETYPE" = "serial" ]; then
      BOOTUP=serial
###:%s@/etc/sysconfig/init@/var/log@gi  命令
5、删除/tmp/functions文件中所有以#开头,且#后面至少有一个空白字符的行的行首的#号;
A sed expression to filter out the files that is_ignored_file recognizes
__sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
  
if [ "$_use_systemctl" = "1" ]; then
        if  [ "x$1" = xstart -o \
                "x$1" = xstop -o \
                "x$1" = xrestart -o \
                "x$1" = xreload -o \
                "x$1" = xtry-restart -o \
                "x$1" = xforce-reload -o \
                "x$1" = xcondrestart ] ; then
        
###:%s@^#[[:space:]]\{1,\}@@  命令

原创文章,作者:RecallWzc,如若转载,请注明出处:http://www.178linux.com/33338

(0)
RecallWzcRecallWzc
上一篇 2016-08-12 09:01
下一篇 2016-08-12 09:01

相关推荐

  • Linux文件系统总结(7.4课上作业)

    一、什么是文件系统         文件系统是对一个存储设备上的数据和元数据进行组织的机制。它使用文件和树形目录的抽象逻辑概念代替了硬盘和光盘等物理设备使用的数据块的概念,用户使用文件系统来保存数据而不必关心数据实际保存在硬盘(or光盘)的地址为多少数据块上,只需要记住这个文件的…

    Linux干货 2016-07-10
  • HA专题: 使用pacemaker+corosync实现MySQL高可用

    HA专题: 使用pacemaker+corosync实现MySQL高可用 前言 实验拓扑 实验环境 实验步骤 准备工作 安装HA组件并配置 配置NFS 配置MySQL 配置HA资源 测试 总结 前言 上篇文章我们介绍了使用pacemkaer+corosync实现简单的nginx高可用, 这篇文章我们介绍如何使用pacemaker+corosync实现MySQ…

    Linux干货 2016-04-11
  • Linux安全与加密基础(一)

    Linux安全与加密基础(一) 常见的加密算法 SSL: Openssl与CA认证 ssh服务 dropbear AIDE sudo 常见的加密算法 密码学古以有之,尤其是在中国古代的战争中,在现在科技中,密码学不得不说是一门高深的学问,普通人知其一二足矣;本文要讨论的是关于加密与解密的基本原理与应用,以及关于Linux系统中的一些安全管理问题,如ssh服务…

    Linux干货 2016-10-06
  • CentOS7.2编译安装httpd

    环境:CentOS7.2 软件包:httpd-2.2.29.tar.bz2 1、解压缩httpd-2.2.29.tar.bz2 2、进入解压过的文件夹,查看用法(INSTALL、)后然后./configure –help查看参数后执行需要的参数操作,     通过选项传递参数,指定启用特性,安装路径的等,…

    Linux干货 2016-08-24
  • ansible运维自动化工具

      ansible简介 运维工具分类:         agent:基于专用的agent程序完成管理功能,puppet, func, zabbix, …        agent…

    Linux干货 2016-11-11
  • 逻辑卷(LVM)管理实例详解

    LVM基本术语 下面是LVM需要了解的基本术语:    物理卷(PV physical volume): 它可以是物理硬盘上的分区,也可以是整块物理硬盘;  卷组(VG volume group): 建立在物理卷之上,一个卷组至少包括一个物理卷,可以动态增删物理卷;  逻辑卷(LV logical volume):建立…

    Linux干货 2016-09-01