Linux Shell
beikejinmiao
加油。
展开
-
用shell将时间字符串与时间戳互转
date +%s 可以得到UNIX的时间戳; 用shell将时间字符串与时间戳互转: date -d "2010-10-18 00:00:00" +%s 输出形如:1287331200 而时间戳转换为字符串可以这样做: date -d @1287331200 "+%Y-%m-%d" 输出形如:2010-10-18 如果需要得到指定日期的转载 2014-01-23 14:16:58 · 1003 阅读 · 0 评论 -
Linux下删除无用的(很久没有访问或者修改)的文件
#path="/root" #directory path path=$1 if [ ! -d $1 ]; then ##判断目录是否存在 echo "Directory '$1' does not exist Or '$1' is not a directory!" exit 0 fi if [ ! -x $1 -o ! -r $1 ]; then ##验原创 2014-01-23 12:54:06 · 2626 阅读 · 1 评论 -
Linux Shell 判断语句常用参数详解
来源鳥哥的 Linux 私房菜http://linux.vbird.org/linux_basic/0340bashshell-scripts.php#rule原创 2014-01-23 14:23:26 · 1046 阅读 · 0 评论 -
修改Ubuntu默认Shell
奇怪的错误在linux下的shell脚本中,第一行一般会指明该脚本的执行程序名,以便为该脚本拥有执行权限时可以通过脚本名直接运行。 我在控制台上一般通过 sh 命令执行shell脚本,如sh xxx.sh;所以有次我新建一个shell脚本时,脚本第一行写的是#!/bin/sh原创 2015-09-24 14:35:27 · 7875 阅读 · 1 评论