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.www58058.com/33338

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

相關推薦

  • 軟件包管理工具—rpm命令總結

    描述:    RPM是RedHatPackageManager的縮寫,是由RedHat公司開發的軟件包安裝和管理程序,同Windows平臺上的Uninstaller比較類似。使用RPM,用戶可以自行安裝和管理Linux上的應用程序和系統工具。RPM可以讓用戶直接以binary方式安裝軟件包,并且可替用戶查詢是否已經安裝了有關的庫文件;在用…

    Linux干貨 2016-08-29
  • N26-第九周作業-邢巖

    馬哥門徒-N26-邢巖 相信自己、勤奮努力、不斷總結!shell腳本練習需要重復、重復、再重復!那么,我就繼續來寫、寫、寫。 1、寫一個腳本,判斷當前系統上所有用戶的shell是否為可登錄shell(即用戶的shell不是/sbin/nologin);分別這兩類用戶的個數;通過字符串比較來實現; #******************************…

    Linux干貨 2017-04-03
  • 馬哥教育網絡班N22期+第4周課程練習

    馬哥教育網絡班N22期+第4周課程練習 1. 復制/etc/skel目錄為/home/tuser1,要求/home/tuser1及其內部文件的屬組和其它用戶均沒有任何訪問權限。 cp -rf /etc/skel /home/tuser1  chmod -R go= tuser1/ 2. 編…

    Linux干貨 2016-09-19
  • N26 第三周作業

    1、列出當前系統上所有已經登錄的用戶的用戶名,注意:同一個用戶登錄多次,則只顯示一次即可。    who | cut -d" " -f1 | sort -u    2、取出最后登錄到當前系統的用戶的相關信息。    who | tail -1 3、取…

    Linux干貨 2017-02-16
  • LVM詳解

    Linux的LVM詳解 LVM組成; LVM:logic volume manager .LVM即邏輯卷管理,現在使用版本為第二版,即version2 邏輯卷:pv,physical volume,即計算機上的磁盤設備,例如我的計算機上的/dev/sda3,/dev/sda5. 卷組:vg,volume group。一般由多個pv組成。 邏輯卷:lv,log…

    Linux干貨 2016-02-14
  • mariadb數據庫的主從復制

    mariadb的主從復制

    2018-02-27
欧美性久久久久