Adding Android SDK platform-tools to PATH downloaded from umake
Solution 1
This worked for me
export PATH=$PATH:$HOME"/android-sdk-linux/platform-tools"
Solution 2
If you install Android SDK through Android Studio (or any other way that put you Android SDK folder under this path), execute this line:
export PATH=$PATH:$HOME"/Android/Sdk/platform-tools"
Solution 3
I added this line to the bottom of my .bashrc and it works.
export PATH=/home/[myusername]/android-sdk-linux/platform-tools:$PATH
source ~/.bashrc #To update the bashrc with the changes in the current tab
I don't understand the PATH=${PATH}
syntax in your example, so I can't comment on whether it's correct or not, but you could try the syntax I used.
Solution 4
I installed Android Studio via snap. So I had to add the platform-tools folder path to the .bashrc file.
If you use visual studio code as editor type this in the terminal
code ~/.bashrc
It will open the visual studio code and the .bashrc file is opened in it. Go to the bottom of the file and add the following export,
# Android Path if [ -d "$HOME/Android/Sdk/platform-tools" ] ; then export PATH="$HOME/Android/Sdk/platform-tools:$PATH" fi
Note: Leave and empty line at the end of .bashrc file. So the shell program knows it is the end of file (EOF).
Saved the .bashrc file and quit visual studio code
Go to Terminal and source the updated .bashrc file
source ~/.bashrc
Related videos on Youtube
user1974014
Updated on September 18, 2022Comments
-
user1974014 almost 2 years
I am creating a javascript function that retrieves an
xxd
(bash) output and splits it into 3 pieces. The left piece (with offsets) called offsets, a middle piece called rawVals and the right piece called sidebar.I have tested the regular on plenty of other
xxd
outputs and they all work. However, when the following output is given, the regular expression seems to add unexpected characters:Output (some offsets flipped for explaining purpose):
00054280: c003 000a b042 0000 8b95 0e00 0000 0000 .....B.......... 00054290: 0000 0000 cf11 0000 8b95 0e00 0000 0000 ................ 00054260: 8502 a861 2000 0000 3c40 8c49 fd5d 8646 ...a ...<@.I.].F 00054270: 3c40 8c49 ac00 8484 8400 0000 0000 0000 <@.I............
Normal behaviour results in:
Group 1 Group 2 Group 3 00054280: c003 000a b042 0000 8b95 0e00 0000 0000 .....B.......... 00054290: 0000 0000 cf11 0000 8b95 0e00 0000 0000 ................ Unexpected behaviour results in:
Group 1 Group 2 Group 3 00054260:].F 8502 a861 2000 0000 3c40 8c49 fd5d 8646 ].F ...a ...<@.I.].F 00054270:... 03c40 8c49 ac00 8484 8400 0000 0000 0000 ... <@.I............ For some reason
].F
&...
are added after the offset and rawVals content.Javascript code:
function getSplitXxdOutput(content){ var splitRegex = /([a-fA-F0-9]*:)(?: )((?:[a-fA-F0-9]{4} ){8})(?: )(.{16})/g var offsets = content.replace(new RegExp(splitRegex), '$1'); var rawVals = content.replace(new RegExp(splitRegex), '$2'); var sidebar = content.replace(new RegExp(splitRegex), '$3'); return [offsets.split("\n"), rawVals, sidebar.split("\n")]; }
Code as snippet:
var input = `00054260: 8502 a861 2000 0000 3c40 8c49 fd5d 8646 ...a [email protected].].F 00054270: 3c40 8c49 ac00 8484 8400 0000 0000 0000 <@.I............ 00054280: c003 000a b042 0000 8b95 0e00 0000 0000 .....B..>....... 00054290: 0000 0000 cf11 0000 8b95 0e00 0000 0000 ................ 000542a0: c100 6300 6f00 6c00 6f00 7200 7300 2e00 ..c.o.l.o.r.s... 000542b0: 6a00 7000 6700 0000 0000 0000 0000 0000 j.p.g........... 000542c0: 0502 f4e0 2000 0000 6040 8c49 7967 3e49 .... [email protected]>I 000542d0: 6040 8c49 4000 8484 8400 0000 0000 0000 @.I@...........`; function getSplitXxdOutput(content){ var splitRegex = /([a-fA-F0-9]*:)(?: )((?:[a-fA-F0-9]{4} ){8})(?: )(.{16})/g var offsets = content.replace(new RegExp(splitRegex), '$1'); var rawVals = content.replace(new RegExp(splitRegex), '$2'); var sidebar = content.replace(new RegExp(splitRegex), '$3'); return [offsets.split("\n"), rawVals, sidebar.split("\n")]; } var output = getSplitXxdOutput(input); console.log(output);
The content variable is a string that contains the
xxd
output. The global regular expression is written to splitRegex and splits the output in 3 capturing groups:- all a-F characters and numbers followed by a ":"
- all a-F characters and numbers followed by a space and this 4 x 8 (xxxx times 8)
- the values (can be any character, 16 of them)
Some ideas and what I have tried to solve the problem:
- I have checked the regular expression on regexr.com where it behaves as expected, even with the aforementioned output. Which makes me think the problem is not related to the regular expression.
- I have the feeling that the reason for the unexpected behaviour is caused by the "<" character. When it is removed manually, the problem seems to be solved.
- I have tried escaping some of the special characters but that doesn't seem to solve the problem. Since I am not certain of the success of the used method, I didn't include it in the question.
- I could replace the character but then the output is altered with, which is not the solution I want.
Is there a way to write "<" without escaping it and to avoid it being executed or cause the issue?
Output of console.log that is retrieved from the
element:
'''html 00054260: 8502 a861 2000 0000 3c40 8c49 fd5d 8646 ...a [email protected].].F 00054270: 3c40 8c49 ac00 8484 8400 0000 0000 0000 <@.I............ 00054280: c003 000a b042 0000 8b95 0e00 0000 0000 .....B..>....... 00054290: 0000 0000 cf11 0000 8b95 0e00 0000 0000 ................ 000542a0: c100 6300 6f00 6c00 6f00 7200 7300 2e00 ..c.o.l.o.r.s... 000542b0: 6a00 7000 6700 0000 0000 0000 0000 0000 j.p.g........... 000542c0: 0502 f4e0 2000 0000 6040 8c49 7967 3e49 .... ...
@.Iyg>I 000542d0: 6040 8c49 4000 8484 8400 0000 0000 0000
@.I@........... '''It is retrieved with:
var selectedHtml = document.getElementById(id).querySelectorAll("code"); var content = selectedHtml[1].querySelectorAll(".xxd-content");
-
Kalle Richter almost 9 yearsWhat say
which adb
andwhich -a adb
?
-
Admin almost 7 years
PATH=$PATH:[path to add]
means that the path will be appended at the end to the original Path-variable. You usedPATH=[path to add]:$PATH
, what means that the path will be appended before the Path-variable.