You have a shell script that assigns a value to the variable "CPU" then you 
want to pass the value of that variable to cfgmaker, right?  Just put a dollar 
sign ($) before your variable name in the script and the shell will substitute 
it with the value.

This doesn't have anything to do with Perl (or MRTG).  

Let's assume you want to use bash as your shell.  Try this:

#!/bin/bash
CPU=4
/path/to/cfgmaker --host-template=$CPU.tmpl [...]

Your template will have to be named "4.tmpl" and be located in the same 
directory as where you're executing cfgmaker.

Should do the trick.  Hope that helps,

Corey.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of [EMAIL PROTECTED]
Sent: March 17, 2004 2:47 PM
To: [EMAIL PROTECTED]
Subject: [mrtg] Accessing Shell Variables in Template


Hi MRTG-gurus,

I try to create different config files using --host-template 
depending on the number of CPUs a server has.

I have the following shell script

CPU = 4
cfgmaker --host-template=...

What do I have to do to access the Variable CPU in the template?

I know absolutely nothing about Perl so would be very grateful for
any help

Thanks in advance
Thomas Rupp 

--
Unsubscribe mailto:[EMAIL PROTECTED]
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

--
Unsubscribe mailto:[EMAIL PROTECTED]
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

Reply via email to