免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 10513 | 回复: 12
打印 上一主题 下一主题

TFILE1=/tmp/`basename $0`.$$ 其中的$$是什么意思? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-29 11:58 |只看该作者 |倒序浏览
TFILE1=/tmp/`basename $0`.$$
VICTIM1=/etc/httpd/conf/httpd-common.conf
BINFILE=/usr/sbin/httpd-ent

if [ ! -x $BINFILE ] ; then
    echo ERROR no version of apache installed in $BINFILE
前三句是定义变量,想知道其中的$$是什么意思?

论坛徽章:
0
2 [报告]
发表于 2009-09-29 12:04 |只看该作者
$$代表你这个shell脚本的pid
这里这么做是为了不让文件名重复

论坛徽章:
5
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015年亚洲杯之朝鲜
日期:2015-03-13 22:47:33IT运维版块每日发帖之星
日期:2016-01-09 06:20:00IT运维版块每周发帖之星
日期:2016-03-07 16:27:44
3 [报告]
发表于 2009-09-29 12:05 |只看该作者
Man see bash Man

论坛徽章:
3
CU大牛徽章
日期:2013-03-13 15:29:07CU大牛徽章
日期:2013-03-13 15:29:49CU大牛徽章
日期:2013-03-13 15:30:19
4 [报告]
发表于 2009-09-29 12:29 |只看该作者
进程ID变量

论坛徽章:
0
5 [报告]
发表于 2009-09-29 13:59 |只看该作者
$      Expands  to  the  process ID of the shell.  In a () subshell, it
              expands to the process ID of the current  shell,  not  the  sub-
              shell.
谢谢楼上所有的兄弟们!

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
6 [报告]
发表于 2009-09-29 15:31 |只看该作者

List of Special Characters and Their Meanings

CharacterWhereMeaning
ESCcshFilename completion.
RETURNcsh, shExecute command.
spacecsh, shArgument separator.
TABcsh, shArgument separator.
TABbashFilename completion.
#csh, shStart a comment.
`csh, shCommand substitution (backquotes).
"csh, shWeak quotes.
'csh, shStrong quotes.
\csh, shSingle?character quote.
$varcsh, shVariable.
${var}csh, shSame as $var.
$var:modcshEdit var with modifier mod
${var?default}shIf var not set, use default.
${var=default}shIf var not set, set it to default and use that value.
${var+instead}shIf var set, use instead. Otherwise, null string.
${var?message}shIf var not set, print message (else default). If var set, use its value.
${var#pat}ksh, bashValue of var with smallest pat deleted from start.
${var##pat}ksh, bashValue of var with largest pat deleted from start.
${var%pat}ksh, bashValue of var with smallest pat deleted from end.
${var%%pat}ksh, bashValue of var with largest pat deleted from end.
|csh, shPipe standard output.
|&cshPipe standard output and standard error.
^shPipe character (obsolete).
^csh, bashEdit previous command line.
&csh, shRun program in background.
?csh, shMatch one character.
*csh, shMatch zero or more characters.
;csh, shCommand separator.
;;sh[/td]End of case statement.[/tr]
~csh, ksh, bashHome directory.
~usercsh, ksh, bashHome directory of user.
!csh, bashCommand history.
-ProgramsStart of optional argument.
-ProgramsRead standard input. (Only certain programs.)
$#csh, shNumber of arguments to script.
"$@"shOriginal arguments to script.
$*csh, shArguments to script.
$-shFlags set in shell.
$?shStatus of previous command.
$$csh, shProcess identification number.
$!shProcess identification number of last background job.
$<cshRead input from terminal.
cmd1 && cmd2csh, shExecute cmd2 if cmd1 succeeds.
cmd1 || cmd2csh, shExecute cmd2 if cmd1 succeeds.
$(..)ksh, bashCommand substitution.
((..))ksh, bashArithmetic evaluation.
\. fileshExecute commands from file in this shell.
:shEvaluate arguments, return true.
:shSeparate values in paths.
:cshVariable modifier.
[]csh, shMatch range of characters.
[]shTest.
%jobcsh, ksh, bashIdentify job number.
(cmd;cmd)csh, shRun cmd;cmd in a subshell.
{}csh, bashIn?line expansions.
{cmd;cmd;}shLike (cmd;cmd) without a subshell.
>filecsh, shRedirect standard output.
>>filecsh, shAppend standard output.
<filecsh, shRedirect standard input.
<<wordcsh, shRead until word, do command and variable substitution.
<<\wordcsh, shRead until word, no substitution.
<?wordshRead until word, ignoring leading TABs.
>>! filecsh, shAppend to file, even if noclobber set and file doesn't exist.
>! filecshOutput to file, even if noclobber set and file exists.
>| fileksh, bashOutput to file, even if noclobber set and file exists.
>& filecshRedirect standard output and standard error to file.
m> fileshRedirect output file descriptor m to file.
m>> fileshAppend output file descriptor m to file.
m< fileshRedirect input file descriptor m from file.
<&mshTake standard input from file descriptor m.
<&?shClose standard input.
>&mshUse file descriptor m as standard output.
>&-shClose standard output.
m<&nshConnect input file descriptor n to file descriptor m.
m<&-shClose input file descriptor m.
n>&mshConnect output file descriptor n to file descriptor m.
m>&-shClose output file descriptor m.


[ 本帖最后由 Shell_HAT 于 2009-9-29 15:40 编辑 ]

论坛徽章:
0
7 [报告]
发表于 2009-09-29 15:53 |只看该作者

回复 #6 Shell_HAT 的帖子

真是好东东! 谢谢! 学习学习。

[ 本帖最后由 greendays 于 2009-9-29 15:55 编辑 ]

论坛徽章:
0
8 [报告]
发表于 2011-04-12 18:54 |只看该作者

论坛徽章:
0
9 [报告]
发表于 2012-01-11 14:44 |只看该作者
回复 6# Shell_HAT


    谢谢你的解释,好全。正需要呢

论坛徽章:
0
10 [报告]
发表于 2012-02-07 10:29 |只看该作者
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP