FunctionRacerProblemsRace

Shift Them Up

HardBasha shell script

A program writes to app.log and keeps two older logs beside it. Make room for a new one: app.log.2 becomes app.log.3, app.log.1 becomes app.log.2, app.log becomes app.log.1, and a new, empty app.log takes its place. Nothing that was in the three files may be lost.

Example 1

app.log
today
app.log.1
yesterday
app.log.2
two days ago
ends as
== ./app.log
== ./app.log.1
today
== ./app.log.2
yesterday
== ./app.log.3
two days ago

Constraints

Race itor take your time

Write it in your browser, against the clock. The model script, with a note on each command it uses, comes after.

More Bash problems