#!/bin/sh # # $Id$ # # this shell script is designed to merely dump the configuration # information about how the net-snmp package was compiled. The # information is particularly useful for applications that need to # link against the net-snmp libraries and hence must know about any # other libraries that must be linked in as well. check_build_dir() { build_dir=$1 if test "x$build_dir" = "x" ; then echo "You must specify a build directory." exit 1 fi # is it the src dir? if test -f $build_dir/net-snmp-config.in ; then return fi # make sure we can find build dir if test ! -d $build_dir/snmplib/.libs ; then echo "$build_dir does not appear to be a build directory." exit 1 fi } # usage: index n arguments # effect: returns the (n+1)th argument index() { eval echo \$`expr $1 + 1` } # usage: count arguments # effect: returns the number of arguments count() { echo $# } prefix=/opt/alt/net-snmp11/usr exec_prefix=/opt/alt/net-snmp11/usr includedir=/opt/alt/net-snmp11/usr/include libdir=/opt/alt/net-snmp11/usr/lib64 datarootdir=${prefix}/share NSC_LDFLAGS="-Wl,-z,relro -Wl,-z,now -lm" NSC_LIBS="" NSC_LNETSNMPLIBS=" -lssl -lssl -lcrypto" NSC_LAGENTLIBS=" " NSC_LMIBLIBS="-lsensors -ldl -lrpm -lrpmio " NSC_INCLUDEDIR=${includedir} NSC_LIBDIR=-L${libdir} NSC_SNMPLIBS="-lnetsnmp ${NSC_LNETSNMPLIBS}" NSC_SUBAGENTLIBS="-lnetsnmpagent ${NSC_LAGENTLIBS} ${NSC_SNMPLIBS}" NSC_AGENTLIBS="-lnetsnmpmibs ${NSC_LMIBLIBS} ${NSC_SUBAGENTLIBS}" NSC_PREFIX=$prefix NSC_EXEC_PREFIX=$exec_prefix NSC_SRCDIR=. NSC_INCDIR=${NSC_PREFIX}/include NSC_BASE_SNMP_LIBS="-lnetsnmp" NSC_BASE_SUBAGENT_LIBS="-lnetsnmpagent ${NSC_BASE_SNMP_LIBS}" NSC_BASE_AGENT_LIBS="-lnetsnmpmibs ${NSC_BASE_SUBAGENT_LIBS}" NSC_SRC_LIBDIRS="agent/.libs snmplib/.libs" NSC_SRC_LIBDEPS="agent/.libs/libnetsnmpmibs.a agent/.libs/libnetsnmpagent.a snmplib/.libs/libnetsnmp.a" if test "x$NSC_SRCDIR" = "x." ; then NSC_SRCDIR="NET-SNMP-SOURCE-DIR" elif test "x$NSC_SRCDIR" = "x" ; then NSC_SRCDIR="NET-SNMP-SOURCE-DIR" fi if test "x$1" = "x"; then usage="yes" else while test "x$done" = "x" -a "x$1" != "x" -a "x$usage" != "xyes"; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac unset shifted case $1 in --prefix=*) prefix=$optarg NSC_PREFIX=${prefix} NSC_INCLUDEDIR=${prefix}/include NSC_LIBDIR=-L${prefix}/lib ;; --exec-prefix=*) exec_prefix=$optarg NSC_EXEC_PREFIX=${exec_prefix} NSC_LIBDIR=-L${exec_prefix}/lib ;; --debug-tokens|--deb*|--dbg*) echo "find $NSC_SRCDIR -name \"*.c\" -print | xargs grep DEBUGMSGT | grep \\\" | cut -f 2 -d\\\" | sort -u" if test "x$NSC_SRCDIR" != "xNET-SNMP-SOURCE-DIR" ; then /usr/bin/find $NSC_SRCDIR -name "*.c" -print | xargs grep DEBUGMSGT | grep \" | cut -f 2 -d\" | sort -u fi ;; --indent-options|--in*) echo "indent -orig -nbc -bap -nut -nfca `(cd $NSC_INCDIR/net-snmp; perl -n -e 'print "-T $1 " if (/}\s*(netsnmp_\w+)\s*;/);' */*.h)`" ;; --configure-options|--con*) echo " '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--exec-prefix=/opt/alt/net-snmp11/usr' '--bindir=/opt/alt/net-snmp11/usr/bin' '--sbindir=/opt/alt/net-snmp11/usr/sbin' '--datadir=/opt/alt/net-snmp11/usr/share' '--includedir=/opt/alt/net-snmp11/usr/include' '--libdir=/opt/alt/net-snmp11/usr/lib64' '--libexecdir=/opt/alt/net-snmp11/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/opt/alt/net-snmp11/usr/share/man' '--infodir=/opt/alt/net-snmp11/usr/share/info' '--disable-agent' '--disable-applications' '--disable-debugging' '--disable-embedded-perl' '--disable-manuals' '--disable-scripts' '--disable-static' '--enable-as-needed' '--enable-blumenthal-aes' '--enable-ipv6' '--enable-local-smux' '--enable-mfd-rewrites' '--enable-shared' '--enable-ucd-snmp-compatibility' '--prefix=/opt/alt/net-snmp11/usr' '--sysconfdir=/etc' '--with-cflags=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include' '--with-defaults' '--with-install-prefix=/opt/alt/net-snmp11/usr' '--with-ldflags=-Wl,-z,relro -Wl,-z,now -lm' '--with-logfile=/var/log/snmpd.log' '--with-mib-modules=host agentx smux ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable ip-mib/ipAddressPrefixTable/ipAddressPrefixTable ip-mib/ipDefaultRouterTable/ipDefaultRouterTable ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable sctp-mib rmon-mib etherlike-mib ucd-snmp/lmsensorsMib' '--with-openssl=/opt/alt/opnessl11' '--with-perl-modules=INSTALLDIRS=vendor' '--with-persistent-directory=/var/lib/net-snmp' '--with-pic' '--with-security-modules=tsm' '--with-sys-contact=Unknown' '--with-sys-location=Unknown' '--with-systemd' '--with-temp-file-pattern=/run/net-snmp/snmp-tmp-XXXXXX' '--with-transports=DTLSUDP TLSTCP' '--without-perl-modules' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include' 'LDFLAGS=-L/opt/alt/openssl11/lib64 -L/opt/alt/libssh211/usr/lib64 -Wl,-rpath=/opt/alt/openssl11/lib64,-rpath=/opt/alt/libssh211/usr/lib64' 'CPPFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include' 'PKG_CONFIG_PATH=:/opt/alt/net-snmp11/usr/lib64/pkgconfig:/opt/alt/net-snmp11/usr/share/pkgconfig'" ;; --snmpd-module-list|--mod*) echo ip-mib/ipAddressPrefixTable/ipAddressPrefixTable ip-mib/ipDefaultRouterTable/ipDefaultRouterTable mibII/mta_sendmail ucd-snmp/diskio ucd-snmp/lmsensorsMib agentx/master agentx/subagent host/hrh_storage host/hrh_filesys host/hrSWInstalledTable host/hrSWRunTable host/hr_system host/hr_device host/hr_other host/hr_proc host/hr_network host/hr_print host/hr_disk host/hr_partition ip-mib/ipAddressTable/ipAddressTable ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get ip-mib/ipIfStatsTable/ipIfStatsTable ip-mib/ipIfStatsTable/ipIfStatsTable_interface ip-mib/ipIfStatsTable/ipIfStatsTable_data_access ip-mib/ipv4InterfaceTable/ipv4InterfaceTable ip-mib/ipv6InterfaceTable/ipv6InterfaceTable ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable sctp-mib/sctpScalars smux/smux util_funcs/header_simple_table agentx/protocol agentx/master_admin agentx/agentx_config agentx/client etherlike-mib/dot3StatsTable/dot3StatsTable etherlike-mib/dot3StatsTable/dot3StatsTable_data_get etherlike-mib/dot3StatsTable/dot3StatsTable_data_set etherlike-mib/dot3StatsTable/dot3StatsTable_data_access etherlike-mib/dot3StatsTable/dot3StatsTable_interface host/data_access/swinst host/data_access/swrun host/hrSWRunPerfTable util_funcs if-mib/data_access/interface ip-mib/ipAddressTable/ipAddressTable_interface ip-mib/ipAddressTable/ipAddressTable_data_access ip-mib/data_access/defaultrouter_common ip-mib/data_access/defaultrouter_linux ip-mib/data_access/systemstats_common ip-mib/data_access/systemstats_linux ip-mib/ipIfStatsTable/ipIfStatsTable_data_get if-mib/ifTable/ifTable_interface if-mib/ifTable/ifTable_data_access if-mib/ifTable/ifTable ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access rmon-mib/etherStatsTable/etherStatsTable rmon-mib/etherStatsTable/etherStatsTable_data_get rmon-mib/etherStatsTable/etherStatsTable_data_set rmon-mib/etherStatsTable/etherStatsTable_data_access rmon-mib/etherStatsTable/etherStatsTable_interface sctp-mib/sctpScalars_common sctp-mib/sctpScalars_linux sctp-mib/sctpTables_common sctp-mib/sctpAssocRemAddrTable sctp-mib/sctpAssocLocalAddrTable sctp-mib/sctpLookupLocalPortTable sctp-mib/sctpLookupRemPortTable sctp-mib/sctpLookupRemHostNameTable sctp-mib/sctpLookupRemPrimIPAddrTable sctp-mib/sctpLookupRemIPAddrTable sctp-mib/sctpAssocTable sctp-mib/sctpTables_linux util_funcs/get_pid_from_inode tcp-mib/tcpConnectionTable/tcpConnectionTable tcp-mib/tcpListenerTable/tcpListenerTable hardware/sensors/hw_sensors hardware/sensors/lmsensors_v3 udp-mib/udpEndpointTable/udpEndpointTable etherlike-mib/data_access/dot3stats_linux hardware/memory/hw_mem hardware/memory/memory_linux hardware/fsys/hw_fsys hardware/fsys/fsys_mntent host/data_access/swinst_rpm host/data_access/swrun_procfs_status hardware/cpu/cpu hardware/cpu/cpu_linux util_funcs/header_generic if-mib/data_access/interface_linux if-mib/data_access/interface_ioctl ip-mib/data_access/ipaddress_common ip-mib/data_access/ipaddress_linux ip-mib/data_access/ipv6scopezone_common ip-mib/data_access/ipv6scopezone_linux rmon-mib/data_access/etherstats_linux tcp-mib/data_access/tcpConn_common tcp-mib/data_access/tcpConn_linux tcp-mib/tcpConnectionTable/tcpConnectionTable_interface tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access tcp-mib/tcpListenerTable/tcpListenerTable_interface tcp-mib/tcpListenerTable/tcpListenerTable_data_access udp-mib/udpEndpointTable/udpEndpointTable_interface udp-mib/udpEndpointTable/udpEndpointTable_data_access ip-mib/data_access/ipaddress_ioctl udp-mib/data_access/udp_endpoint_common udp-mib/data_access/udp_endpoint_linux ;; --default-mibs|--mibs|--MIBS) echo :EtherLike-MIB:HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES:MTA-MIB:NETWORK-SERVICES-MIB:RMON-MIB:SCTP-MIB:TCP-MIB:UCD-DISKIO-MIB:LM-SENSORS-MIB:UDP-MIB ;; --default-mibdirs|--mibdirs|--MIBDIRS) echo $HOME/.snmp/mibs:/opt/alt/net-snmp11/usr/share/snmp/mibs ;; --env-separator) echo ":" ;; --exeext) echo "" ;; --snmpconfpath|--SNMPCONFPATH) echo "/etc/snmp:/opt/alt/net-snmp11/usr/share/snmp:/opt/alt/net-snmp11/usr/lib64/snmp:$HOME/.snmp:/var/lib/net-snmp" ;; --persistent-directory|--persistent-dir) echo /var/lib/net-snmp ;; --perlprog|--perl) echo /usr/bin/perl ;; #################################################### compile --base-cflags) echo -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -DNETSNMP_REMOVE_U64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include -Ulinux -Dlinux=linux -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include -I${NSC_INCLUDEDIR} ;; --cflags|--cf*) echo -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -DNETSNMP_REMOVE_U64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include -Ulinux -Dlinux=linux -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include -I. -I${NSC_INCLUDEDIR} ;; --srcdir) echo $NSC_SRCDIR ;; #################################################### linking --libdir|--lib-dir) echo $NSC_LIBDIR ;; --ldflags|--ld*) echo $NSC_LDFLAGS ;; --build-lib-dirs) shift build_dir=$1 check_build_dir $build_dir for dir in $NSC_SRC_LIBDIRS; do result="$result -L$build_dir/$dir" done echo $result ;; --build-lib-deps) shift build_dir=$1 check_build_dir $build_dir for dir in $NSC_SRC_LIBDEPS; do result="$result $build_dir/$dir" done echo $result ;; --build-includes) shift build_dir=$1 check_build_dir $build_dir result="-I$build_dir/include" if test "$build_dir" != "$NSC_SRCDIR" -a "$NSC_SRCDIR" != "NET-SNMP-SOURCE-DIR" then result="$result -I$NSC_SRCDIR/include" fi echo $result ;; --build-command) echo "gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -DNETSNMP_REMOVE_U64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include -Ulinux -Dlinux=linux -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/opt/alt/openssl11/include" ;; #################################################### client lib --libs) # use this one == --netsnmp-libs + --external-libs echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS ;; --netsnmp-libs) echo $NSC_LIBDIR $NSC_BASE_SNMP_LIBS ;; --external-libs) echo $NSC_LDFLAGS $NSC_LNETSNMPLIBS $NSC_LIBS ;; #################################################### agent lib --base-agent-libs) echo $NSC_BASE_AGENT_LIBS ;; --base-subagent-libs) echo $NSC_BASE_SUBAGENT_LIBS ;; --agent-libs) # use this one == --netsnmp-agent-libs + --external-libs echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS ;; --netsnmp-agent-libs) echo $NSC_LIBDIR $NSC_BASE_AGENT_LIBS ;; --external-agent-libs) echo $NSC_LDFLAGS $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS ;; #################################################### --version|--ver*) echo 5.8 ;; --help) usage="yes" ;; --prefix|--pre*) echo $NSC_PREFIX ;; --exec-prefix) echo $NSC_EXEC_PREFIX ;; #################################################### --create-snmpv3-user) done=1 shift net-snmp-create-v3-user $* exit $? ;; #################################################### --compile-subagent) shift shifted=1 while test "x$done" = "x" -a "x$1" != "x" ; do case $1 in --norm) norm=1 shift ;; --cflags) shift if test "x$1" = "x" ; then echo "You must specify the extra cflags" exit 1 fi cflags="$1" echo "setting extra cflags: $cflags" shift ;; --ldflags) shift if test "x$1" = "x" ; then echo "You must specify the extra ldflags" exit 1 fi ldflags="$1" echo "setting extra ldflags: $ldflags" shift ;; --*) echo "unknown suboption to --compile-subagent: $1" exit 1 ;; *) if test "x$outname" = "x"; then outname=$1 shift else done=1 fi ;; esac done tmpfile=netsnmptmp.$$.c if test -f $tmpfile; then echo "Ack. Can't create $tmpfile: already exists" exit 1 fi echo "generating the temporary code file: $tmpfile" rm -f $tmpfile cat > $tmpfile < #ifdef HAVE_SIGNAL #include #endif /* HAVE_SIGNAL */ #ifdef HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #ifdef HAVE_FCNTL_H #include #endif /* HAVE_FCNTL_H */ #include #include EOF # If we were only given a single filename # (and no explicit output name) # then use that as the base of the output name # # If we weren't even given that, then bomb out if test "x$1" = "x"; then if test "x$outname" = "x"; then echo "No MIB module codefile specified" rm -f $tmpfile exit 1 else cfiles=$outname outname=`basename $cfiles | sed 's/\.[co]$//'` if test -f $outname.h; then if grep "init_$outname" $outname.h; then echo " #include \"$outname.h\"" >> $tmpfile fi fi fi fi # add include files while test "$1" != ""; do cfiles="$cfiles $1" name=`basename $1 | sed 's/\.[co]$//'` if test -f $name.h; then if grep "init_$name" $name.h; then echo " #include \"$name.h\"" >> $tmpfile fi fi shift done cat >> $tmpfile <> $tmpfile fi done # handle the main loop cat >> $tmpfile <> $tmpfile fi i=`expr $i - 1` done # finish file cat >> $tmpfile <