Reputation: 39
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.
Upvotes: 0
Views: 167
Reputation:
According to documentation, you need to use hwclock to read/write from /dev/rtc. You are seeing a raw output of this interface.
See also: http://linux.die.net/man/4/rtc
Upvotes: 2