I try to echo the result of a command. But my problem is that the result has strange values at the end and I can not delete them.
My result after the command is for example:
fnRead
results to 12. Juni 13:32:18 2028 þ§
But I only need 12. Juni 13:32:18 2028 because I want to check the equivalence of two strings
My code that generates this output is a function:
fnRead() {
echo $(cat /dev/rtc)
}
I tried to cut off the last strings but it will only remove numbers from the year.
Im working with shell scripts by the way.
cat /dev/rtcwould do the job; there's no need for the command substitution andecho.var=$(cat /dev/rtc)— or, in Bash,var=$(</dev/rtc)— to assign to a variable for later use and thenechofor debugging/checking purposes. Separately, haven't they fixed things like this by the year 2028? I was hoping things would have improved by then. And thank you for dropping back to chat with us. Does this mean that SO doesn't exist still in 2028?