小编meh*_* oz的帖子

git 错误:无法初始化工作树

我正在尝试从其存储库下载特殊的 Android TV AOSP 代码。我运行 repo init

repo sync -fc -j8 
Run Code Online (Sandbox Code Playgroud)

像往常一样命令,但在获取所有内容后,我总是收到以下错误消息。

.
.
Fetching projects:  98% (431/439)  Fetching project platform/vendor/widevine
Fetching projects: 100% (439/439), done.  
Syncing work tree:  97% (426/439)  error: unable to read sha1 file of x86_64/vmlinux-qemu (11819c0a8aefd3cb8d0e87884ff44abda7bba2ad)
Traceback (most recent call last):
File "/home/mehmet/l_mrl-tv-dev-avko/.repo/repo/main.py", line 531, in <module>
_Main(sys.argv[1:])
File "/home/mehmet/l_mrl-tv-dev-avko/.repo/repo/main.py", line 507, in _Main
    result = repo._Run(argv) or 0
File "/home/mehmet/l_mrl-tv-dev-avko/.repo/repo/main.py", line 180, in _Run
    result = cmd.Execute(copts, cargs)
File "/home/mehmet/l_mrl-tv-dev-avko/.repo/repo/subcmds/sync.py", line 762, in Execute
    project.Sync_LocalHalf(syncbuf, …
Run Code Online (Sandbox Code Playgroud)

git

5
推荐指数
1
解决办法
4957
查看次数

如何在shell中使用curl检查内容类型

我想检查服务器中文件的内容类型。以下代码总是回显“图像大小无效”。

    TYPE=$(curl -sI $IMAGE_LINK | grep Content-Type)
    IFS=" "
    set $TYPE
    echo $2

    if [ $2 == "image/gif" ] 
    then
        echo "image size is valid"
        exit 0  
    else
        echo "image size is invalid"
        exit 1
    fi  
Run Code Online (Sandbox Code Playgroud)

这是输出。当 $2 是“image/gif”时,为什么比较不起作用?

image/gif
image size is invalid
Run Code Online (Sandbox Code Playgroud)

此外,这是我不需要的解决方案。

    TYPE=$(curl -sI $IMAGE_LINK | grep "Content-Type: image/gif")
    echo $TYPE

    if [ ! "$TYPE" = "" ]
Run Code Online (Sandbox Code Playgroud)

bash shell curl http

1
推荐指数
1
解决办法
979
查看次数

标签 统计

bash ×1

curl ×1

git ×1

http ×1

shell ×1