#!/bin/sh # Give a free ID to use lastID=`tail -1 /etc/IDs | cut -d' ' -f1` freeID=`expr $lastID + 1` if [ $freeID -lt 10 ] then echo -e "Next free ID: 000$freeID\n" elif [ $freeID -lt 100 ] then echo -e "Next free ID: 00$freeID\n" elif [ $freeID -lt 1000 ] then echo -e "Next free ID: 0$freeID\n" else echo -e "Next free ID: $freeID\n" fi