Skip to content

Instantly share code, notes, and snippets.

@mikemikhaylov
Last active November 7, 2022 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikemikhaylov/145cea6f966814b6c63bc78c05935a15 to your computer and use it in GitHub Desktop.
Save mikemikhaylov/145cea6f966814b6c63bc78c05935a15 to your computer and use it in GitHub Desktop.
Past file line by line to Android emulator via adb input text
#!/bin/bash
start=$(date +%s)
#EDIT to your value
export PATH=$PATH:/Users/mikhailmikhaylov/Library/Android/sdk/platform-tools/
echo Starting
#PUT content you want to paste here
file="input.txt"
IFS=$'\n'
for line in `cat "$file"`
do
echo "Sending ${line}"
#CAUTION sends new line char at the end, to remove add -n after echo keyword
echo "$line" | adb shell xargs -0 input text
done
end=$(date +%s)
echo "Elapsed Time: $(($end-$start)) seconds"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment