#!/system/bin/sh if [ -f /bkdata/com.vrt.varc ]; then cp /mnt/sdcard/com.vrt.varc /bkdata/com.vrt.varc fi 加过了还是执行报错
时间: 2023-10-31 10:34:58 浏览: 35
这段脚本的作用是将SD卡上的文件`/mnt/sdcard/com.vrt.varc`复制到`/bkdata/com.vrt.varc`。如果执行时报错,可能是因为没有执行权限或者文件路径不正确。你可以尝试使用`chmod +x`命令给脚本添加执行权限,或者检查文件路径是否正确。另外,你可以提供更详细的报错信息,以便我们更好地帮助你解决问题。
相关问题
#!/system/bin/sh if [ -f /bkdata/com.vrt.varc ]; then cp /mnt/sdcard/com.vrt.varc /bkdata/com.vrt.varc fi
这是一个 shell 脚本,主要作用是将 /mnt/sdcard/com.vrt.varc 文件复制到 /bkdata/com.vrt.varc 中。
如果 /bkdata/com.vrt.varc 文件不存在,此脚本不会创建它。如果 /mnt/sdcard/com.vrt.varc 文件不存在,则会出现错误消息。
请注意,此脚本可能需要在具有 root 权限的 Android 设备上运行。
#!/system/bin/sh if [ -f /bkdata/com.vrt.varc ]; then cp /mnt/sdcard/com.vrt.varc /bkdata/com.vrt.varc fi android10 执行报错/system/bin/sh: /vendor/bin/copy.sh[3]: syntax error: unmatched 'if'
你的脚本中 if 语句的结尾缺少了一个关键字 "fi",导致语法错误。正确的脚本应该像这样:
```sh
#!/system/bin/sh
if [ -f /bkdata/com.vrt.varc ]; then
cp /mnt/sdcard/com.vrt.varc /bkdata/com.vrt.varc
fi
```
请注意 if 和 fi 必须成对出现,if 后面的条件语句要用方括号 [] 括起来。
相关推荐
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![whl](https://img-home.csdnimg.cn/images/20210720083646.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)