26/60
Sign inSign up free

751. Read Files or Standard Input, Like cat

medium 20 XP ~10 minHands-on lab

Good Unix filters work both in pipelines and on files. Write /home/student/bin/upper.sh [FILE...] that converts text to upper case.

Task

  • With no arguments, read standard input.
  • Otherwise process each FILE in order; the name - means standard input.
  • A FILE that can't be read: print upper.sh: <FILE>: cannot read to stderr, continue with the next one, and at the end exit 1.
  • Otherwise exit 0.
  • Write the converted text to stdout, unchanged except for the case (keep empty lines and a last line without newline).

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.