#!/bin/sh # # yesn word n -- repeat n times and add a single newline WORD=${1?"what word?"} N=${2?"what N?"} yes "$WORD" | sed "${N}q" | tr -d '\n' echo