bash - 在 UBUNTU 上编码 BASH curl 的 URL
问题描述
我正在通过 gitook 传递以下行
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 尝试过,现在它似乎没有执行,重新启动,没有乐趣
解决方案
乔丹马上就看到了。
我们正在从初始化程序编写挂钩文件,并且我们不需要转义引号,因为 bash 会注入变量
我今天早上起床时看到了它,拍了拍我的额头,孩子们晚上不要编码。
会考虑删除,因为除了我以外的任何人都无法学习 - 每 12 小时离开屏幕一次?
推荐阅读
- python - pandas groupby 并按不同因素聚合
- jquery - 动态添加+删除div中的可排序div
- google-maps - 想创建谷歌地图图层
- python - os.system 路径中有空格
- json - 如何将 Json 响应输入到 Empty ant 设计表中?
- swift - 这段代码解释了如何在 swift 中使用 Alamofire。但错误是“源文件中的编辑器占位符”。如何解决这个问题?
- spring - 这个 Spring 版本的名称是什么?
- arrays - 使用 Zapier Json 对象数组触发多个 webhook
- ios - Swift Spritekit - 只有在特定位置时才会碰撞精灵?
- image - 从 Vue.js 中的 props 传递和绑定 img src