随笔分类 -  Shell

摘要:shell脚本中echo显示内容带颜色显示,echo显示带颜色,需要使用参数-e。格式如下:echo-e"\033[41;36msomethinghere\033[0m"其中41的位置代表底色,36的位置是代表字的颜色 。注: 1、字背景颜色和文字颜色之间是英文的"" 2、文字颜色后面有个m ... 阅读全文
posted @ 2015-12-21 16:32 Vman 阅读(292) 评论(0) 推荐(0)
摘要:getfattr用法 用于获取文件扩展属性,返回一系列键值对,参考 "Linux Man Page" 。 常用OPTIONS n name, name=name Dump the value of the named extended attribute extended attrib... 阅读全文
posted @ 2015-11-16 11:33 Vman 阅读(4720) 评论(0) 推荐(0)
摘要:1 root@kali:~# uname -a;bash --version;2 Linux kali 3.7-trunk-686-pae #1 SMP Debian 3.7.2-0+kali5 i686 GNU/Linux3 GNU bash, 版本 4.2.37(1)-release (i486-pc-linux-gnu)4 Copyright (C) 2011 Free Software Foundation, Inc.5 许可证 GPLv3+: GNU GPL 许可证版本3或者更高 <http://gnu.org/licenses/gpl.html>6 7 这是自由软件,您 阅读全文
posted @ 2013-04-25 21:52 Vman 阅读(558) 评论(0) 推荐(0)
摘要:字符串操作:1.获取字符串的长度 ${#stringname} expr length $string expr "$string" : '.*' #这个没看明白2.子串索引位置 expr index $string $substring3.子串提取的方法 ${string:position} #在$string中从位置$position开始提取子串. #如果$string是"*"或者"@", 那么将会提取从位置$position开始的位置参数. ${string:position:length} #在$string中 阅读全文
posted @ 2012-06-26 16:36 Vman 阅读(495) 评论(0) 推荐(0)
摘要:View Code 1 #!/bin/bash 2 #arglist.h 3 #2012-06-14 4 5 E_BADARGS=65 6 7 if [ ! -n "$1" ] 8 then 9 echo "Usage: `basename $0` argument1 argument2 etc."10 exit $E_BADARGS11 fi12 echo13 14 index=115 #注意16 echo "Listing args with \"\$*\":"17 for arg in "$*&qu 阅读全文
posted @ 2012-06-14 20:26 Vman 阅读(2037) 评论(1) 推荐(0)
摘要:作用从标准输入中读取一行语法read [ -p ][ -r ][ -s ][ -u[ n ] ] [ VariableName?Prompt ][ VariableName ... ]描述read 命令从标准输入中读取一行,并把输入行的每个字段的值指定给 shell 变量,用 IFS(内部字段分隔符)变量中的字符作为分隔符。VariableName参数指定 shell 变量的名称,shell 变量获取输入行一个字段的值。由VariableName 参数指定的第一个 shell 变量指定给第一个字段的值,由 VariableName 参数指定的第二个shell 变量指定给第二个字段的值,以此类推 阅读全文
posted @ 2011-09-29 18:52 Vman 阅读(33374) 评论(1) 推荐(1)