
脚本
jamex
这个作者很懒,什么都没留下…
展开
-
脚本的故事
脚本故事 - 2003年11月发布者 The Scripting Guys如果脚本是非法的,那么只有非法者才使用脚本如需获得脚本专栏所有脚本故事的列表以及其他信息,请点击此处。Microsoft 的员工生活在虚幻的世界中,这是针对 Microsoft 员工的批评之一。意思是说我们这些 Microsoft 员工只是关注各种理想情况而对于系统管理员真正需要面对的实际问题却从不考虑。这可能适用与某些 M转载 2005-09-26 12:22:00 · 1376 阅读 · 0 评论 -
在Linux中用source,dot(.)和直接用脚本文件名执行shell脚本的区别 .
用source,dot(.)的方式执行shell脚本的时候,不产生子进程,shell脚本在当前的shell中运行,shell脚本运行完成后,在shell脚本中声明的变量在当前的shell中是可见的.直接用脚本文件名的方式执行shell脚本的时候,产生子进程,shell脚本在子进程中运行,shell脚本运行完成后,在shell脚本中声明的变量在当前的shell中是不可见的.验证过程:转载 2014-05-06 18:45:19 · 1072 阅读 · 0 评论 -
[转]linux shell 获取当前正在执行脚本的绝对路径
原文链接:http://sexywp.com/bash-how-to-get-the-basepath-of-current-running-script.htm 常见的一种误区,是使用 pwd 命令,该命令的作用是“print name of current/working directory”,这才是此命令的真实含义,当前的工作目录,这里没有任何意思说明,这个目录就是脚本存放的目录。所转载 2014-05-06 18:41:16 · 767 阅读 · 0 评论 -
How do I determine if a web page exists with shell scripting?
Under a *NIX, you can use curl to issue a simple HEAD request (HEAD only asks for the headers, not the page body):curl --head http://myurl/Then you can take only the first line, which contains t转载 2014-05-10 14:01:39 · 606 阅读 · 0 评论 -
Oracle Weblogic nodemanager STOP script Bash and Python
Everyone who is using Oracle Weblogic must had a thought like “Where the *** is the stop script to kill my nodemanager proces”…. Well, i did. So i wrote a simple stop script which can be better proba转载 2014-05-10 14:07:44 · 888 阅读 · 0 评论 -
bash split string into array
In a bash script I would like to split a line into pieces and put them into an array.The line:Paris, France, EuropeI would like to have them in an array like this:array[0] = Parisarray[1] =转载 2014-05-10 14:25:52 · 1699 阅读 · 0 评论 -
Listing only directory using ls in bash
This command lists directory in the current path: ls -d */What exactly the pattern */ does?And how can we give absolute path in the above command (like ls -d /home/alice/Documents) for listing onl转载 2014-05-10 13:58:32 · 807 阅读 · 0 评论 -
Linux Bash script to remove files older than 3 days
Can someone help me with a bash script to remove files older than 3 days in directory /u1/database/prod/arch?转载 2014-05-10 14:10:40 · 783 阅读 · 0 评论 -
How to check the first character in a string in unix
Many ways to do this. You could use wildcards in double brackets:str="/some/directory/file"if [[ $str == /* ]]; then echo 1; else echo 0; fiYou can use substring expansion:if [[ ${str:0:1}转载 2014-05-10 14:22:50 · 821 阅读 · 0 评论 -
How to start weblogic managed servers without manually entering the password
While starting a managed server in weblogic, we start with below command. 1 /bin/startManagedWebLogic.sh soa_server1 t3://localhost:7001 This command will prompt to manually enter the use转载 2014-05-10 14:30:33 · 844 阅读 · 0 评论 -
Start and Stop Oracle Weblogic NodeManager Via Shell Alias
Start and Stop Oracle Weblogic NodeManager via Shell Alias This tip is to create two simple bash shell environment alias for starting and stoping Weblogic Node Manager. No script is needed. A转载 2014-05-10 14:03:26 · 720 阅读 · 0 评论 -
Linux Grep OR, Grep AND, Grep NOT Operator Examples
Question: Can you explain how to use OR, AND and NOT operators in Unix grep command with some examples? Answer: In grep, we have options equivalent to OR and NOT operators. There is no grep AND op转载 2014-05-10 14:05:59 · 904 阅读 · 0 评论 -
-bash: ./my_script: /bin/bash^M: bad interpreter: No such file or directory
26down voteaccepted I have seen this issue when creating scripts in Windows env and then porting over to run on a unix environment.Try running this on the script:http://linuxcommand.org/man_p转载 2014-05-10 14:27:46 · 861 阅读 · 0 评论 -
【转】linux shell -- 块注释
使用#可以注掉一行脚本,但shell没有提供类似c语言/* */的成块注释符。所以shell中的块注释只能通过一些技巧实现。1. 使用here document:语句块block这里的block是标识符,可以自定义。注意不要与语句块中的字符产生冲突。解释:最前面的:表示空命令,是bash的内建命令。一个here document就是一段带有特殊目的的代码段。它使用I转载 2014-05-06 18:47:34 · 1953 阅读 · 0 评论 -
Linux Shell - Trying to split a string into two variables
I'm trying to split a string into two variables (without having to use a while loop):var="hello:world"IFS=':' read var1 var2 echo "var1: $var1"echo "var2: $var2".. but i'm not getting the de转载 2014-04-18 18:06:00 · 738 阅读 · 0 评论 -
正则表达式匹配任意字符(包括换行符)的写法
在正则中,匹配任意字符,其实写法网上有很多,但因为各种软件或程序写法不支持等原因导致的问题,大家可以多研究。今天在Java中想使用正则表达式来获取一段文本中的任意字符。于是很随意得就写出如下匹配规则: (.*) 结果运行之后才发现,无法获得换行之后的文本。于是查了一下手册,才发现正则表达式中,“.”(点符号)匹配的是除了换行符“\n”以外的所有字符。同时,手册上还有一句转载 2014-04-18 18:22:47 · 1298 阅读 · 0 评论 -
常用正则表达式集锦
"^/d+$" //非负整数(正整数 + 0) "^[0-9]*[1-9][0-9]*$" //正整数 "^((-/d+)|(0+))$" //非正整数(负整数 + 0) "^-[0-9]*[1-9][0-9]*$" //负整数 "^-?/d+$" //整数 "^/d+(/./d+)?$" //非负浮点数(正浮点数 + 0) "^(([0-9]+/.[0-9转载 2006-10-31 15:22:00 · 978 阅读 · 0 评论 -
关于cmd命令的重定向输出
<br />关于cmd命令的重定向输出 2>&1<br />mycommand >mylog.txt 2>&1 应该是最经典的用法了。<br />命令的结果可以通过“%>”的形式来定向输出,%表示文件描述符:1为标准输出stdout、2为标准错误stderr。系统默认%值是1,也就是“1>”,而1>可以简写为>,也就是默认为>。stdout的默认目标是终端,stderr的默认目标为也是终端。我们在批处理中执行: echo text >result.txt ,我们就可以在屏幕上会看到 echo text 1>转载 2011-03-29 18:12:00 · 933 阅读 · 0 评论 -
2个CMD命令例子 - for tokens delims echo - checkDayOfMonth and add datetime into file name
<br />checkDayOfMonth.bat<br /> <br />@echo off<br />for /F "tokens=1,2,3,4 delims=/ " %%a in ('echo %date%') do set day=%%c & set month=%%b & set year=%%d<br />set /a leap=%year% %% 4<br />if %leap%==0 (set eom=29) else (set eom=28)<br />echo 01 03 05 07原创 2011-04-08 18:20:00 · 1164 阅读 · 0 评论 -
ECHO命令详解
<br />ECHO命令是大家都熟悉的DOS批处理命令的一条子命令,但它的一些功能和用法也许你并不是全都知道,不信你瞧: <br />1. 作为控制批处理命令在执行时是否显示命令行自身的开关 <br /><br />格式:ECHO [ON|OFF] <br /><br />如果想关闭“ECHO OFF”命令行自身的显示,则需要在该命令行前加上“@”。 <br /><br />2. 显示当前ECHO设置状态 <br /><br />格式:ECHO <br /><br />3. 输出提示信息 <b转载 2011-04-08 18:21:00 · 2195 阅读 · 0 评论 -
如何用命令行清空Windows回收站?
The command line to empty Recycle Bin looks something like this :ATTRIB %systemdrive%\RECYCLER\* -R -S -H /S /DRD %systemdrive%\RECYCLER转载 2011-09-15 18:13:08 · 13254 阅读 · 0 评论 -
在cmd中FOR的用法
FOR %variable IN (set) DO command [command-parameters]%variable 指定一个单一字母可替换的参数。(set) 指定一个或一组文件。可以使用通配符。command 指定对每个文件执行的命令。command-parameters 为特定命令指定参数或命令行开关。在批处理文件中使用转载 2012-03-23 15:43:37 · 1422 阅读 · 0 评论 -
CMD文件中用FOR命令读取文本文件内容到变量,以及和PsExec搭配使用的方法和例子
CMD文件中用FOR命令读取文本文件内容到变量,以及和PsExec搭配使用的方法和例子--------------rollback_ALL.cmdFOR /F %%i in (%1\dest_path.txt) DO set dest_path=%%iFOR /F %%j in (%1\destbak_path.txt) DO set destbak_path=%%jFOR /原创 2012-03-23 15:50:47 · 4401 阅读 · 0 评论 -
DOS CMD批处理FOR 中的Delims和Tokens总结
在For命令语句的参数F中,最难理解的就是Delims和Tokens两个选项,本文简单的做一个比较和总结。“For /f”常用来解析文本,读取字符串。分工上,delims负责切分字符串,而tokens负责提取字符串。如果把字符串当作蛋糕,Delims像刀子,用来切蛋糕,tokens像叉子,用来取切好的蛋糕。下面我们用实例来进行理解。把以下内容保存为文本文件“歌曲列表.txt”,注意转载 2012-07-04 17:00:46 · 6534 阅读 · 0 评论 -
如何用DOS命令,获取一个目录下的文件数目
发信人: GOOGOODALLS (我爱Figo), 信区: DOS标 题: 如何用DOS命令,获取一个目录下的文件数目?发信站: 水木社区 (Fri Mar 9 08:40:01 2007), 站内如何用DOS命令,获取一个目录下的文件数目,并写入文件?因为自己编译脚本,不想再写一个.exe 程序来查找。希望能用现成的脚本来实现。Thanks!--ht转载 2012-07-04 17:05:35 · 991 阅读 · 0 评论 -
获得目录文件数和剩余容量的dos命令
@echo off for /f %%i in ('dir /s *.*^|find /i "个文件"') do set num=%%i echo. echo 文件数量统计结果: echo. echo D:\movie目录下有 %num% 个文件 echo. echo. echo D盘空间统计结果: echo. echo 盘符 剩余空间(字节) 分区大小(字转载 2012-07-04 19:09:00 · 1904 阅读 · 0 评论 -
用Windows命令行如何检查Windows系统补丁(KBxxxxxx)的最后一次安装时间?
在打开的DOS命令窗口中,输入以下命令:wmic qfe list full /format:htable >C:\Temp\hotfixes.htm 这个命令会创建一个已安装微软补丁包的HTML列表。直接命令行输出:wmic qfe list full 用SYSTEMINFO命令可以看到安装了哪些补丁。原创 2013-01-16 12:37:31 · 11787 阅读 · 0 评论 -
How to read a file line by line?
BRMarch 2014 1.Example 1.Tips 2.Bonus 2.Initiate a Loop3.See also: While read LINE This article introduces the concept of playing a file line by line in Linux with the help of exa转载 2014-04-18 17:56:41 · 853 阅读 · 0 评论 -
How do I grab an INI value within a shell script?
I have a parameters.ini file, such as:[parameters.ini] database_user = user database_version = 20110611142248I want to read in and use the database version specified in the parameters转载 2014-05-10 14:32:49 · 586 阅读 · 0 评论