Indenting output in a shell script with pr
When printing output in a shell script, it's quite useful to be able to indent information to group it. The easiest way to do this is with pr, like this: body=$(curl -s "http://localhost:8888/") echo "Response:" echo "$body" | pr -to 4 This generates: Response: { "links": { "games": "/games" } } Given that pr appeared in version 1 of AT&T Unix, I'm late to the party with this one, but it's a useful thing to… continue reading.