随笔- 649
文章- 0
评论- 144
阅读-
851万
03 2013 档案
Linux下命令行显示当前全路径方法
摘要:/etc/profile 和 ~/.bashrc 或者直接在用户的.bash_profile中添加 export PS1="[/u@/h /`pwd/`]$" 或export PS1='[\u@\h \W]\$' 为机器名着色 PS1='\[\033[1m\033[31m\][Machine_nam
阅读全文
java遍历hashMap、hashSet、Hashtable
摘要:一.遍历HashMapMap<Integer, String> map = new HashMap<Integer, String>(); for(int i=0;i<100;i++) { map.put(i, "123"); }方法一:效率比方法二高for(Entry<Integer, String> entry:map.entrySet()) { System.out.println(entry.getKey()+"="+entry.getValue()); }方法二:for(Object obj : map
阅读全文
shell里面的参数
摘要:$0 这个程式的执行名字,及脚本名$n 这个程式的第n个参数值,n=1..9$* 这个程式的所有参数,此选项参数可超过9个。$# 这个程式的参数个数$$ 这个程式的PID(脚本运行的当前进程ID号)$! 执行上一个背景指令的PID(后台运行的最后一个进程的进程ID号)$? 执行上一个指令的返回值 (显示最后命令的退出状态。0表示没有错误,其他任何值表明有错误)$- 显示shell使用的当前选项,与set命令功能相同$@ 跟$*类似,但是可以当作数组用
阅读全文
一个shell写的urldecode代码
摘要:转自:http://aaronw.me/static/779.html这是第一种方法:(标点符号会漏掉)#!/bin/shawk ‘BEGIN {hextab=”0123456789ABCDEF”for ( i=1; i<=255; ++i ) ord [i] = sprintf(“%c”,i);}{decoded = “”for ( i=1; i<=length ($0); ++i ) {c = substr ($0, i, 1)if ( c ~ /[a-zA-Z0-9.-]/ ) {decoded = decoded c # safe character} else if (
阅读全文