Anyway, what I did to solve this problem.
Defined in what cases I need to run these commands. For most ubuntu users there is a home folder (hidden file .bashrc
).
In which you can record the launch of these commands. But these commands will be triggered when you enter the bash
command in the console.
Since I have a shell .zshrc then I did the following:
open console: gedit .zshrc
When the file opens, add the following line:
./.add_device_permissions.sh
After or before, we need to create this file: .add_device_permissions.sh
in which we write the following:
#!/bin/bash
# Add permissions for Xiaomi Redmi Note 5
ADB="/home/vadimm/Android/Sdk/platform-tools/adb"
$ADB devices
$ADB kill-server
cat .permissions_redmi_note | sudo -S $ADB devices
$ADB kill-server
cat .permissions_redmi_note | sudo -S $ADB devices
Also we need create .permissions_redmi_note where we need to hardcode our password.
- Not to add to the file
.zshrc
unnecessary we can specify the path when starting the system itself: Startup Applications Preferences
Where we press on "Add" and write our command: /home/vadimm/.add_device_permissions.sh