shell 常用1
2013-01-09 12:56 brookin 阅读(165) 评论(0) 编辑 收藏 举报字符串切割
str="abcdefg" #字符串切割 echo ${abc:0:3} #输出abc
文件分发
scp.exp
#!/usr/bin/expect if {$argc<4} { puts stderr "Usage: ./scp.exp \[SRC_FILE\] \[DST_IP\] \[DST_DIR\] \[PASSWORD\]" exit 1 } set SRC_FILE [lindex $argv 0] set IP [lindex $argv 1] set DEST_DIR [lindex $argv 2] set PASSWORD [lindex $argv 3] spawn /usr/local/bin/scp -P 36000 $SRC_FILE user_00@$IP:$DEST_DIR expect "*assword:" send $PASSWORD"\r" expect eof
屏蔽dos2unix输出
dos2unix /tmp/file.txt >/dev/null 2>&1
echo 不含换行符
[user_00@txyun ~]$ echo "00003f30e2ffd363e798f03b61bbcf00" | wc 1 1 33 [user_00@txyun ~]$ echo -n "00003f30e2ffd363e798f03b61bbcf00" | wc 0 1 32
echo Description:
-n do not output the trailing newline -e enable interpretation of backslash escapes -E disable interpretation of backslash escapes (default)
作者:brookin
出处:http://www.cnblogs.com/brookin/
本文采用知识共享署名-非商业性使用-相同方式共享 2.5 中国大陆许可协议进行许可,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
出处:http://www.cnblogs.com/brookin/
本文采用知识共享署名-非商业性使用-相同方式共享 2.5 中国大陆许可协议进行许可,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。