#!/bin/sh OUR_NUMBER=$1 ; [ -z "$OUR_NUMBER" ] && OUR_NUMBER=512 SYSFILE=/a/etc/system ; [ -f $SYSFILE ] || SYSFILE=/etc/system [ -s $SYSFILE ] || { echo system file has zero size - try to revert to previous copy by hand. Exiting exit 1 } cp $SYSFILE $SYSFILE.before_adding_ptys CURRENT_NUMBER=`grep '^set' $SYSFILE | awk '{if($2=="pt_cnt") print $4}'` if [ -z "$CURRENT_NUMBER" ] ; then CURRENT_NUMBER=`grep '^set' $SYSFILE | grep pt_cnt= | awk '{print $2}' | awk -F= '{print $NF}'` fi if [ -z "$CURRENT_NUMBER" ] ; then echo "* * PTYs added by ryjova on `date` * set pt_cnt = 512" >>$SYSFILE elif [ "$CURRENT_NUMBER" -lt "$OUR_NUMBER" ] ; then sed -e ' /^set *pt_cnt *= *[0-9]+*/{ c\ * \ * Previous PTY Count '${CURRENT_NUMBER}' replaced by ryjova \ *\ set pt_cnt = 512\ * } ' $SYSFILE.before_adding_ptys >$SYSFILE echo "pt_cnt changed from $CURRENT_NUMBER to $OUR_NUMBER" else echo "pt_cnt is already set to $CURRENT_NUMBER - leaving it" fi