How to check file exists via bash script?

前端 未结 2 944
轮回少年
轮回少年 2021-01-23 23:10

I\'m trying to clone a repo and test it after is done via bash script. I have written my test code based on Bash Shell: Check File Exists or Not.

#!/bin/bash

ec         


        
2条回答
  •  心在旅途
    2021-01-23 23:44

    Change it to this (use a relative path):

    INFER_PATH="./infer/infer/bin/infer"
    [ -e ${INFER_PATH} ] && echo "Infer downloaded successfully" || echo "Something went wrong :("
    

    and it should work.

提交回复
热议问题