首页 新闻 会员 周边

windows上git bash中chmod +x不起作用

0
悬赏园豆:30 [已解决问题] 解决于 2018-05-28 10:27

在 windows 上的 git bash 中执行下面的 chmod 命令

$ chmod +x test.sh

执行后对应的文件依然是不可执行的

-rw-r--r-- 1 admin 197121   0 5月  16 11:57 test.sh

请问如何解决?

dudu的主页 dudu | 高人七级 | 园豆:30994
提问于:2018-05-16 12:07
< >
分享
最佳答案
1

git update-index --chmod=+x <your_file>

在 Windows 平台上需要使用上面的命令把文件标记为可执行

收获园豆:30
不如隐茶去 | 小虾三级 |园豆:559 | 2018-05-27 22:16

(tensorflow) E:\下载的杂\mssb\text-detection-ctpn-banjin-dev\utils\bbox>chmod +x make.sh
'chmod' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

(tensorflow) E:\下载的杂\mssb\text-detection-ctpn-banjin-dev\utils\bbox>git update-index --chmod=+x make.sh
'git' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

这该怎么解决呢?

00101010101001 | 园豆:200 (初学一级) | 2022-01-06 21:47
其他回答(1)
0

test.sh 脚本头部加上 #!/bin/sh 或者 #!/bin/bash 指定解释器试试.

ohyex | 园豆:1496 (小虾三级) | 2018-05-16 13:22

添加 #!/bin/bash 之后在 windows 上的 git bash 中变为可执行,但到 linux 上依然不可执行

支持(0) 反对(0) dudu | 园豆:30994 (高人七级) | 2018-05-16 14:10
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册