limit looping

This commit is contained in:
fluxgen 2004-01-12 11:14:55 +00:00
parent 2db11d2104
commit a1ff4f84e6

View file

@ -22,7 +22,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# $Id: fluxbox-generate_menu.in,v 1.10 2004/01/03 00:43:43 fluxgen Exp $
# $Id: fluxbox-generate_menu.in,v 1.11 2004/01/12 11:14:55 fluxgen Exp $
#
# Portability notes:
@ -220,8 +220,11 @@ clean_up() {
# Some magic to clean up empty menus
rm -f ${MENUFILENAME}.tmp
touch ${MENUFILENAME}.tmp
until diff -u ${MENUFILENAME} ${MENUFILENAME}.tmp > /dev/null 2>&1; do
local counter=10 # prevent looping in odd circumstances
until [ $counter -lt 1 ] || \
diff -u ${MENUFILENAME} ${MENUFILENAME}.tmp 2>&1 > /dev/null; do
[ -s ${MENUFILENAME}.tmp ] && mv ${MENUFILENAME}.tmp ${MENUFILENAME}
counter=`expr $counter - 1`
grep -v '^$' ${MENUFILENAME}|sed -e "/^\[submenu].*/{
n
N