$0获取当前执行的SHELL脚本的文件名,包括路径.注:basename只要文件名,dirname只要文件所以路径。$n获取当前的执行的shell脚本的第n个参数值,n=1…9,当n为0时表示脚本的文件名,如果n大于9,用大括号括起${10}。$#获取当前shell命令行终参数的总个数,命令演示如上图所示。$..
分类:
系统相关 时间:
2015-06-14 00:41:11
阅读次数:
203
总结:man, info, hwclock, cal, type, which, dirname, basename, who, which, whatis, makewhatis, hash, tty
man, info, help, date, hwclock, cal, shutdown, reboot, halt, poweroff, type, cd, which, dirname, basename, who, which, whatis, makewhatis, echo, hash,...
分类:
其他好文 时间:
2015-06-10 06:30:27
阅读次数:
150
echo的使用记录-n用法:输出不换行
例如:
echo-n"a1:"
echo"b2"
得到:
a1:b2
-e用法:允许后面的输出进行转义
例如:
exit_script()
{
echo-e"\033[1;40;31mInstall$1error,willexit.\n\033[0m"
rm-f$LOCKfile
exit1
}
LOCKfile=/tmp/.$(basename$0)
if[-f"$LOCKfile"]
..
分类:
其他好文 时间:
2015-06-08 19:51:00
阅读次数:
142
书上的脚本比较多记录比较有用的脚本更好的方式检查命令行参数是否为数字40#E_WRONGARGS=85#Non-numericalargument(badargumentformat).
41#
42#case"$1"in
43#"")lines=50;;
44#*[!0-9]*)echo"Usage:`basename$0`lines-to-cleanup";
45#exit$E_WRONGARGS;;
46#*)lines=$1;;
47..
分类:
系统相关 时间:
2015-06-02 15:29:14
阅读次数:
157
#!perl
use warnings;
#use strict;
use threads;
use Thread::Semaphore;
use File::Basename qw(basename);
die "perl $0 \n" if @ARGV != 2;
my $semaphore = Thread::Semaphore->new($ARGV[1]);
my $id = bas...
分类:
编程语言 时间:
2015-06-01 16:45:13
阅读次数:
856
脚本原创,盗转死妈
#!/bin/bash
cmd=$1
script_name=`basename $0`
RMAN_HOME=$2/`date +%Y_%m_%d`
print_usage() {...
分类:
其他好文 时间:
2015-06-01 16:44:44
阅读次数:
171
1.basename #去掉目录路径,返回文件名os.path.basename("c:\temp\test.txt")输出:test.txt2.dirname #去掉文件名,返回目录路径
分类:
编程语言 时间:
2015-05-28 17:54:33
阅读次数:
141
$path = "/home/httpd/html/index.php";$file = basename($path); // $file is set to "index.php"$file = basename($path,".php"); // $file is set to ...
分类:
其他好文 时间:
2015-05-27 12:00:17
阅读次数:
112
作用:去掉文件的目录和后缀1.去掉文件路径1 jenkins@work:~/ci/script$ basename /backup/jenkins/ci/script/Release.sh.bak2 Release.sh.bak2.去掉文件后缀1 jenkins@work:~/ci/script$ ...
分类:
系统相关 时间:
2015-05-26 14:17:42
阅读次数:
171
linux命令,文件与目录(cp,pwd,mkdir,rmdir;ls,cp,rm,mv,basename,dirname;cat,tac,more,less,head,tail,touch,umask,chattr,file,which,locate,find)
1.目录操作:(1)cd (切换目录) cd ~ 回到主目录 cd 回到主目录 cd .. 回到上层目录 cd - 回到刚才的目录 cd /var/spool/mail 绝对路径 cd ../mqueue 相对路径(由/var/spool/mail 转到/var/spool/mqueue...
分类:
系统相关 时间:
2015-05-24 21:44:30
阅读次数:
253