Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/system/bin/sh
- #####################################################################
- #Copyright (C) 2025 Kris Occhipinti
- #https://filmsbykris.com
- #This program is free software: you can redistribute it and/or modify
- #it under the terms of the GNU General Public License as published by
- #the Free Software Foundation version 3 of the License.
- #This program is distributed in the hope that it will be useful,
- #but WITHOUT ANY WARRANTY; without even the implied warranty of
- #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- #GNU General Public License for more details.
- #You should have received a copy of the GNU General Public License
- #along with this program. If not, see <http://www.gnu.org/licenses/>.
- ######################################################################
- # This script will print your last 25 sms messages
- # although the number can be changed on the "head" line
- # it does need to look through all your messages
- # so the output might take a little while
- # also see https://pastebin.com/uYFB929z
- echo "Loading Messages..."
- projection="address:date_sent:body"
- content query --uri content://sms/ --projection ${projection}|\
- tr "\n" "|"|\
- sed 's/|Row: [0-9]/\n/g'|\
- head -n 25|\
- tac|\
- sed 's/ address=/\nnumber=/g;s/, date_sent=/\ndate=/g;s/, body=/\n/g'|\
- tr "|" "\n"|while read line;do
- if [[ $line == "date="* ]]; then
- # Format Date
- d=(${line//=/ })
- date -d @${d[1]}
- elif [[ $line == "number="* ]]; then
- # Format Phone Number
- number=(${line//+/ })
- echo "${number[1]:1}" |sed "s/\([0-9]\{3\}\)\([0-9]\{3\}\)\([0-9]*\)/(\1)\2-\3/"
- else
- #Print Message
- echo "$line"
- fi
- done|sed 's/^Row: 0//' # clean up
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement