#!/bin/bash
# This is bash because it uses $() and other bash-isms

# This is a regression test for bug 62740

if [ ! -d /tmp/pts ]; then
  mkdir /tmp/pts
fi

i=0
while [ $i != 1299 ]; do

  mount -t devpts devpts /tmp/pts
  if [ $? != 0 ]; then
    echo "mount failed for $i" >&2
    exit 1
  fi

  umount /tmp/pts
  if [ $? != 0 ]; then
    echo "umount failed for $i" >&2
    exit 1
  fi

  i=$(expr $i + 1)
done
