0

I have a very simple script that tries to get the uptime of the local device and print it out as a string. Here is my script:

#!/usr/bin/bash
UPTIME=$(uptime -p)
printf "Uptime: %s\n" $UPTIME

The output is:

meatcram@digest01:~$ bash test.sh 
Uptime: up
Uptime: 1
Uptime: week,
Uptime: 3
Uptime: days,
Uptime: 1
Uptime: hour,
Uptime: 13
Uptime: minutes

If I run the uptime -p command from the command line, the output looks like a normal text string:

meatcram@digest01:~$ uptime -p
up 1 week, 3 days, 1 hour, 17 minutes

What gives?

0 Answers0