遍历序列恢复二叉树 By duncan21Posted on 2014 年 6 月 24 日Posted in computingNo Comments on 遍历序列恢复二叉树 1.利用前序序列和中序序列恢复二叉树 二叉树的前序遍历是先访问根结点,再按前序遍历方式遍历根结点的左子树和右子树,即由前序序列可以确定二叉树的根结点。另一方面,中序遍历是先中序遍历左子树,然后访问根[……] 阅读全文 Read More
Linux中的 >/dev/null 2>&1 是什么意思 By duncan21Posted on 2014 年 6 月 23 日2015 年 1 月 4 日Posted in LinuxTagged /dev/nullNo Comments on Linux中的 >/dev/null 2>&1 是什么意思 在一些Shell脚本中,特别是Crontab的脚本中,经常会看到 >/dev/null 2>&1这样的写法。 其实这个很好理解。我们分两部分解释。 1.?>/dev/nu[……] 阅读全文 Read More
写一个脚本,实现判断网络里,当前在线用户的IP有哪些 By duncan21Posted on 2014 年 6 月 23 日2015 年 3 月 21 日Posted in Shell 判断是否在线:ping通,ping通后,返回值为0 root@123 [~]# cat 6.sh #!bin/bash for n in `seq 254` do ping -c2 20[……] 阅读全文 Read More
linux下快速清空文本文件中的内容 By duncan21Posted on 2014 年 6 月 19 日2015 年 1 月 4 日Posted in LinuxNo Comments on linux下快速清空文本文件中的内容 1.[root@desktop?huage]#?:?>?filename :是一个占位符,不会产生任何输入 ? 2.[root@desktop?huage]#?>?filename [……] 阅读全文 Read More
使用for循环在/oldboy目录下批量创建文件 By duncan21Posted on 2014 年 6 月 18 日2015 年 1 月 4 日Posted in ShellTagged forNo Comments on 使用for循环在/oldboy目录下批量创建文件 企业面试题:使用for循环在/oldboy目录下批量创建10个文件,名称依次为:oldboy-1oldboy-2oldboy-3……oldboy-10 第一种方法: root@12[……] 阅读全文 Read More
如何打印出001 002 003 这样的格式呢 By duncan21Posted on 2014 年 6 月 16 日2015 年 1 月 4 日Posted in ShellTagged shellNo Comments on 如何打印出001 002 003 这样的格式呢 解答: 思路决定出路!同学们要多思考啊! 本题解决办法太多,举几个例子和初学运维的兄弟分享。 法0:{} [root@C58 scripts]# echo 00{1..3} 001 002[……] 阅读全文 Read More