本文主要是介绍sudo: fastboot: command not found ,fastboot自动补全,adb自动补全,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
使用fastboot时提示 sudo: fastboot: command not found 必须输入完整的命令路径才行,使用起来很麻烦,所以
可以使用下面的方法解决:
le@u:~$ sudo ln -s /home/le/Android/Sdk/platform-tools/fastboot /usr/local/sbin/fastboot
le@u:~$ sudo ln -s /home/le/Android/Sdk/platform-tools/adb /usr/local/sbin/adb
红色部分为fastboot命令路径,需根据实际安装路径确定。
使用fastboot,adb时,如果想使用tab键自动补全命令,可将以下文本复制保存为文件名为fastboot的文件然后放在 /etc/bash_completion.d/目录下
文件名:fastboot
#!/bin/sh
_fastboot()
{local cur prev optsCOMPREPLY=()cur="${COMP_WORDS[COMP_CWORD]}"prev="${COMP_WORDS[COMP_CWORD-1]}"opts="reboot boot flash devices -w reboot-bootloader"case "$prev" inreboot | devices | -w | reboot-bootloader)COMPREPLY=()return 0;;flash)COMPREPLY=( $(compgen -W "boot system recovery radio userdata rpm sbl1 modem tz persist splash aboot" -- $cur ))return 0;;boot)COMPREPLY=( $(compgen -o filenames -G "${cur}*.img"))return 0;;*)local prev2="${COMP_WORDS[COMP_CWORD-2]}"local prev3="${COMP_WORDS[COMP_CWORD-3]}"if [ "$prev2" == "flash" ];thenCOMPREPLY=( $(compgen -o filenames -G "${cur}*.img"))return 0elif [ "$prev2" == "boot" ];thenCOMPREPLY=()return 0elif [ "$prev3" == "flash" ];thenCOMPREPLY=()return 0fi;;esacCOMPREPLY=( $(compgen -W "$opts" -- $cur) )return 0
}
complete -F _fastboot fastboot
adb自动补全,更为完整的实现请参考 S5林风 的博客
文件名:adb (同样放在 /etc/bash_completion.d/ 目录下)
#!/bin/sh
_adb()
{local cur prev optsCOMPREPLY=()cur="${COMP_WORDS[COMP_CWORD]}"prev="${COMP_WORDS[COMP_CWORD-1]}"opts="shell push pull reboot reboot-bootloader forward logcat devices kill-server root remount"case "$prev" inshell | pull | reboot-bootloader | logcat | devices | kill-server | root | remount)COMPREPLY=()return 0;;reboot)COMPREPLY=( $(compgen -W "bootloader recovery" -- $cur) )return 0;;push)COMPREPLY=( $(compgen -o default -o plusdirs -f -- $cur) )return 0;;*)local prev2="${COMP_WORDS[COMP_CWORD-2]}"if [ "$prev2" == "push" ] || [ "$prev2" == "reboot" ];thenreturn 0fi;;esac COMPREPLY=( $(compgen -W "$opts" -- $cur) )return 0
}
complete -F _adb adb
这篇关于sudo: fastboot: command not found ,fastboot自动补全,adb自动补全的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!