RetroFed Forum
Your home away from modern life.
How does this code work?
Post Reply
AuthorMessage
zarkanian sh.itjust.works zarkanian@sh.itjust.works
Joined: 2024-01-11
Quote

I'm studying bash, and I came across this Stackoverflow thread which contains this bit of code:

var="abcde"
echo ${var%d*}

The output is abc, but I can't figure out why. I understand that %d is used to indicate an integer number and * represents anything, but I can't figure out why those together would truncate var to only 3 characters.

1   Original
Post Reply
Back to top