在 UBUNTU 上编码 BASH curl 的 URL

问题描述

我正在通过 githook 传递以下行

curl -d \"githook[action]=code_commit\" -d \"githook[stats]=$encodestat\"  -d \"githook[project_key]=$Vproject\" -d \"githook[user_email]=$Vemail\" -d \"githook[description]=SM$encodemsg\" http://mydomain/githooks 

如果我回应这一行,我会得到

curl -d "githook[action]=code_commit" -d "githook[stats]=%201%20file%20changed%2C%201%20insertion%28%2B%29%2C%201%20deletion%28-%29" -d "githook[project_key]=divine_frost_994_147_5511" -d "githook[user_email]=steven@domain.uk" -d "githook[description]=SMtest%20git" http://mydomain.uk/githooks

当我复制和粘贴时执行并运行

但是,当在 githook 中的第一种形式中触发时,它拒绝无错误地执行

我真的不能再看屏幕了:/

如果有人有任何线索不胜感激,它正在执行然后我收到了一个 GLob 错误,用 -g 尝试了它,现在它似乎没有执行,重新启动,没有乐趣

解决方法

jordanm 立刻就看到了。

我们正在从初始化程序编写钩子文件,我们不需要转义引号,因为 bash 注入了变量

今天早上起床的时候看到的,拍了拍额头,晚上不要写代码孩子。

是否会考虑删除,因为除了我以外的任何人都无法在这里学习 - 每 12 小时离开屏幕一次?