#!/bin/bash #参数定义 date=`date +"%Y-%m-%d-%H:%M:%S"` centosVersion=$(awk '{print $(NF-1)}' /etc/redhat-release) VERSION=`date +%F` #日志相关 LOGPATH="/tmp/awr" [ -e $LOGPATH ] || mkdir -p $LOGPATH RESULTFILE="$LOG
[cairui@cai support-files]$ date "+%d %b %y" 06 Jun 17 (4)设置时间和日期: date -s “格式化的日期字符串” 例子: date -s “21 june 2009 11:01:22” (5)有时,我们需要检查一组命令所花费的时间,以下代码: #!/bin/bash #filename:time_take.sh start=$(date +%s) commands; statements;...
$ type -a echoecho is shell builtinecho is /usr/bin/echoecho is /bin/echo 上面代码表示,echo命令即是内置命令,也有对应的外部程序。 type命令的-t参数,可以返回一个命令的类型:别名(alias),关键词(keyword),函数(function),内置命令(builtin)和文件(file)。 $ type -t bash file $ type -t if k...
date-r <filename> #!/usr/bin/env bashforiin/var/log/*.out;dostat-f"%Sm"-t"%Y-%m-%d %H:%M""$i"echo"$i"done echo"Please type in the directory you want all the files to be listed with last modified dates"#bash can't find file creation datesreaddirectoryforentryin"$directory"/...
--- +" >> $MESSAGE echo "" >> $MESSAGE cat /tmp/file.out | awk '{print $6,$7,$9}' >> $MESSAGE echo "" >> $MESSAGE SUBJECT="WARNING: Apache log folders are deleted older than 15 days $(date)" mail -s "$SUBJECT" "$TO" < $MESSAGE rm $MESSAGE /tmp/file.out fi 给del...
[student@studentvm1 testdir]$ touch TestFile1 在这个简短的 CLI 程序中,修改$File变量的值相比于在多个地方修改表示文件名的字符串的值要容易: [student@studentvm1 testdir]$ File="TestFile1" ; if [ -e $File ] ; then echo "The file $File exists." ; else echo "The file $File does not...
: open shellincurrent dir x: view file/dir attributes i: display image with w3m-img down: scroll down up: scroll up left: go to parent dir right: go to child dir f: new file n: new dir r: rename X: toggle executable y: mark copy m: mark move d: mark trash (~/.local/share...
# shopt -s globstar for file in ~/Pictures/**/*; do printf '%s\n' "$file" done shopt -u globstarglobstar是Bash 4.0才引入的选项,当设置启用globstar(shopt -s globstar)时,两个星号意为对通配符进行展开就可以匹配任何当前目录(包括子目录)以及其的文件;若不启用globstar(shopt -u globstar),...
date.It displays the current date. touch.It creates a new file. pwd.It displays the present working directory. echo.It prints a string of text or a variable value to the terminal. man.It opens the commands manual. which.It displays the Bash shell path. ...
## USAGE[1]: `setupTermuxArch.bash wget sysinfo` shall use wget as the download manager and produce a system information file in the working directory. This can be abbreviated to `setupTermuxArch.bash ws` and `setupTermuxArch.bash w s`. ## USAGE[2]: `setupTermuxArch.bash wget manual...