Error[8]: Undefined offset: 1, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述我在一个bash脚本中看到行数据= $(cat)(只是声明一个空的变量),并且对这可能做什么感到神秘. 我阅读手册页,但没有一个例子或解释.这是否捕获标签?任何有关这方面的文件? 编辑:具体如何做数据= $(cat)允许它运行这个钩子脚本? #!/bin/bash # Runs all executable pre-commit-* hooks and exits after, # if a 我在一个bash脚本中看到行数据= $(cat)(只是声明一个空的变量),并且对这可能做什么感到神秘.

我阅读手册页,但没有一个例子或解释.这是否捕获标签?任何有关这方面的文件?

编辑:具体如何做数据= $(cat)允许它运行这个钩子脚本?

#!/bin/bash # Runs all executable pre-commit-* hooks and exits after,# if any of them was not successful. # # Based on # http://osdir.com/ml/git/2009-01/msg00308.HTML data=$(cat) exitcodes=() hookname=`basename [+++]` # Run each hook,passing through STDIN and storing the exit code. # We don't want to bail at the first failure,as the user might # then bypass the hooks without kNowing about additional issues. for hook in $GIT_DIR/hooks/$hookname-*; do    test -x "$hook" || continue    echo "$data" | "$hook"    exitcodes+=($?)  done

https://github.com/henrik/dotfiles/blob/master/git_template/hooks/pre-commit

解决方法 猫会输出其输出.

在您发布的变量捕获的上下文中,效果是将语句(或包含脚本)的标准输入分配给变量.

命令替换$(command)将返回命令的输出;该赋值会将替换的字符串分配给变量;在没有文件名参数的情况下,cat将会读取和打印标准输入.

您发现这个Git钩子脚本从标准输入捕获提交数据,以便可以分别重复地将其连接到每个钩子脚本.你只得到一个标准输入的副本,所以如果你需要多次,你需要捕获它. (我将使用一个临时文件,并且正确地引用所有的文件名变量;但是将数据保存在一个变量当然可以,尤其是如果你只需要相当少的输入.)

总结

以上是内存溢出为你收集整理的linux – Unix:猫本身做什么?全部内容,希望文章能够帮你解决linux – Unix:猫本身做什么?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
linux – Unix:猫本身做什么?_系统运维_内存溢出

linux – Unix:猫本身做什么?

linux – Unix:猫本身做什么?,第1张

概述我在一个bash脚本中看到行数据= $(cat)(只是声明一个空的变量),并且对这可能做什么感到神秘. 我阅读手册页,但没有一个例子或解释.这是否捕获标签?任何有关这方面的文件? 编辑:具体如何做数据= $(cat)允许它运行这个钩子脚本? #!/bin/bash # Runs all executable pre-commit-* hooks and exits after, # if a 我在一个bash脚本中看到行数据= $(cat)(只是声明一个空的变量),并且对这可能做什么感到神秘.

我阅读手册页,但没有一个例子或解释.这是否捕获标签?任何有关这方面的文件?

编辑:具体如何做数据= $(cat)允许它运行这个钩子脚本?

#!/bin/bash # Runs all executable pre-commit-* hooks and exits after,# if any of them was not successful. # # Based on # http://osdir.com/ml/git/2009-01/msg00308.HTML data=$(cat) exitcodes=() hookname=`basename ` # Run each hook,passing through STDIN and storing the exit code. # We don't want to bail at the first failure,as the user might # then bypass the hooks without kNowing about additional issues. for hook in $GIT_DIR/hooks/$hookname-*; do    test -x "$hook" || continue    echo "$data" | "$hook"    exitcodes+=($?)  done

https://github.com/henrik/dotfiles/blob/master/git_template/hooks/pre-commit

解决方法 猫会输出其输出.

在您发布的变量捕获的上下文中,效果是将语句(或包含脚本)的标准输入分配给变量.

命令替换$(command)将返回命令的输出;该赋值会将替换的字符串分配给变量;在没有文件名参数的情况下,cat将会读取和打印标准输入.

您发现这个Git钩子脚本从标准输入捕获提交数据,以便可以分别重复地将其连接到每个钩子脚本.你只得到一个标准输入的副本,所以如果你需要多次,你需要捕获它. (我将使用一个临时文件,并且正确地引用所有的文件名变量;但是将数据保存在一个变量当然可以,尤其是如果你只需要相当少的输入.)

总结

以上是内存溢出为你收集整理的linux – Unix:猫本身做什么?全部内容,希望文章能够帮你解决linux – Unix:猫本身做什么?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1048244.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存