1、显示当前系统上root、fedora或user1用户的默认shell;egrep‘^(root|fedora|user1)\>‘/etc/passwd|cut-d:-f7
#|表示或者,以:为分隔截取第7段2、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello();grep-o"^[_[:alpha:]]+\(\)"/etc/rc.d/in..
分类:
其他好文 时间:
2016-09-05 17:39:26
阅读次数:
150
1、显示当前系统上root、fedora或user1用户的默认shell;注释:egrep‘^(root|fedora|usr1)\>‘/etc/passwd从/etc/passwd中查找root,fedora,user1用户,存在就匹配,不存在就跳过;cut-d:-f1,7截取第一和第七字段2、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小..
分类:
系统相关 时间:
2016-09-05 17:37:56
阅读次数:
236
1、显示当前系统上root、fedora或user1用户的默认shell;idroot&>/dev/null&&grep"^root\>"/etc/passwd|cut-d:-f7idfedora&>/dev/null&&grep"^fedora\>"/etc/passwd|cut-d:-f7iduser1&>/dev/null&&grep"^user1\>"/etc/p..
分类:
其他好文 时间:
2016-09-05 17:37:46
阅读次数:
162
1、显示当前系统上root、fedora或user1用户的默认shell。[root@centos6-01~]#grep-E"^root\>|^fedora\>|^user1\>"/etc/passwd|cut-d:-f1,7
root:/bin/bash
user1:/sbin/nologin
fedora:/bin/bash2、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,..
分类:
系统相关 时间:
2016-09-05 17:33:20
阅读次数:
278
本周作业内容:1、显示当前系统上root、fedora或user1用户的默认shell;[root@liuhome]#grep-E"^(root|fedora|user1)\>"/etc/passwd|cut-d:-f1,7
root:/bin/bash
user1:/bin/bash
fedora:/bin/bash
#本题使用扩展的正则表达式
#^:首行|:或者():将一个或者多个字符捆绑在一起..
分类:
编程语言 时间:
2016-09-05 17:29:22
阅读次数:
291
1、显示当前系统上root、fedora或user1用户的默认shell;egrep"^root|^fedora|^user1"/etc/passwd|cut-d:-f1,72、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello();grep"\<[[:alpha:]]\+\>()"/etc/rc.d/init.d/functions3、使用echo命令..
分类:
其他好文 时间:
2016-09-05 17:27:26
阅读次数:
127
1、显示当前系统上root、fedora或user1用户的默认shell;[root@bogon~]#useraddfedora#添加用户fedora
[root@bogon~]#useradduser1#添加用户user1
[root@bogon~]#egrep‘^(root|fedora|user1)‘/etc/passwd|cut-d:-f1,7
#使用表达式(root|fedora|user1)查找root、fedora或user1
r..
分类:
编程语言 时间:
2016-09-05 17:25:03
阅读次数:
259
1、显示当前系统上root、fedora或user1用户的默认shell;grep-E"^root|^fedora|^user1\>"/etc/passwd|cut-d:-f1,72、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello();grep-o"[[:alpha:]]\+()"/etc/rc.d/init.d/functions3、使用echo命令输..
分类:
其他好文 时间:
2016-09-05 09:19:41
阅读次数:
150
1、显示当前系统上root、fedora或user1用户的默认shell;grep-E"^(root|user1|fedora)"/etc/passwd|cut-d:-f72、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello();[root@localhost~]#grep-E-o"[[:alpha:]]+\(\)"/etc/rc.d/init.d/functions
ch..
分类:
系统相关 时间:
2016-09-05 00:15:22
阅读次数:
300
1、显示当前系统上root、fedora或user1用户的默认shell;#!/bin/bash
foruserinrootfedorauser1
do
id$user&>/dev/null
if[$?-eq0]
then
cat/etc/passwd|grep^$user|cut-d:-f7
fi
done
//输出:
//下面是或的输出
/bin/bash
#!/bin/bash
foruserinrootmysql
do
id$user&..
分类:
其他好文 时间:
2016-09-04 17:53:04
阅读次数:
228