shell脚本出现问题:unexpected end of file

这个是windows下的shell的结束符在linux下标示失败的问题

可以在linux下vim打开

:set fileformat=unix


系统seq的-f用法:

seq -f '201303%02g.mp4' 1 31|xargs -i cp 20130101.mp5 {}


shell使用mail命令发邮件

echo "hell2o" | mail -s "testtitle" ​​jianfengye110@​


读取脚本的绝对路径:

readlink -f "script/cron/check_translate"

读取当前脚本的路径


windows的TortoiseSVN的右键可以设置忽略哪些文件

这个对于要忽略比如sublime的sftp-config.json特别好用


history命令是先保存在内存中的,当用户退出或者调用history -a的时候才会写入到~/.bash_history

shopt -s histappend

PROMPT_COMMAND="history -a;$PROMPT_COMMAND"

在bash_profile中加入这两条命令能让命令实时写入~/.bash_history



查看centos版本方法有两种

首先可以使用lsb_release -a 命令

这个命令适用所有的linux


查看内核版本使用uname -r


第二种:

cat /etc/redhat-release

或者rpm -q redhat-release


这种适用于RedHat和Centos