I need to create a script which I need to concatenate the result of "date" with "uptime" for example
Date:
date '+%a, %b %d %T %z %Y'
Mon Feb 13 15:04:05 GMT 2023
And when I run uptime into a terminal emulator appears the following:
15:04:34 up 2 days, 20:14, 0 users, load average: 1.95, 1.97, 1.81
Which I need to expect that those command is displayed into a single line:
Mon Feb 13 15:04:05 GMT 2023 15:04:34 up 2 days, 20:14, 0 users, load average: 1.95, 1.97, 1.81
I need perform this script to check the uptime with the date of an Android device using shell
Currently, I have this command but the uptime doesnt appears the "load average data"
adb -s 10.0.0.2:5555 shell ""while true;do date '+%a, %b %d %T %Z %Y $(uptime)';sleep 1;done""
Mon, Feb 13 15:07:44 GMT 2023 12:07:44 up 40 days, 18:33, 0 users, load average: 0.00, 0.00, 0.00
So "Load average appears" 0.00
any helps pls
This is what you need
adb -s 10.0.0.2:5555 shell 'while true; do printf "%s %s\n" "$(date)" "$(uptime)"; sleep 1; done'
notice the use of quotes and printf
to join the output.