Sponsored Content
Top Forums UNIX for Dummies Questions & Answers MAKE and its macros and variables Post 302186801 by JerryHone on Friday 18th of April 2008 05:38:58 AM
Old 04-18-2008
Question MAKE and its macros and variables

I want to build a Makefile that simply takes a template file and modifies it (sed or perl, probably) before installing the result in the right place - my problem is creating the variable for substitution...

So I have

SYSTEM = SYS1 SYS2

SYS1_CHANNELS = CHANNEL1 CHANNEL2 CHANNEL4
SYS2_CHANNELS = CHANNEL3 CHANNEL5

SYS1_FTP_HOST = server1
SYS2_FTP_HOST = server2


I want to build a rule that loops through the $(SYSTEM) values and substitutes in the CHANNELS and FTP_HOST values before modding the template.

I already have...
for system in $(SYSTEM) ;\
do \
ftp_host="$$system"_FTP_HOST ;\
done;

ftp_host is correctly created (SYS1_FTP_HOST) but how do I then use the macro value associated with ftp_host ie 'server1'. It'll get more complicated still looping through the CHANNELS!

Any ideas appreciated.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

troff macros

Hi, I'm going write a small handbook. The typesetting software I'm going to use is troff. There are -ms -me -mm macros for troff. Which one is the most suitable? Thanks! -Tony (2 Replies)
Discussion started by: tonyt
2 Replies

2. UNIX for Dummies Questions & Answers

saving macros for VIM

The question is , as the topic says, how does one save macros for VIM in the .vimrc. I had a look on web and it gave all this ****** about how to build turing machines in vim code or something but i just want to store a macro to like : if(){ } I know how to do it IN vim but .vimrc??????!?!?!... (3 Replies)
Discussion started by: yngwie
3 Replies

3. Shell Programming and Scripting

Expect Terminal Macros

Hey people! I just started out working at an ISP as tech support and thought that I should ease the work load by scripting some small macros. I create different commands with Alias through .bashrc which are all directed to the same script file. Here I planned on using Expect to run different... (0 Replies)
Discussion started by: GhettoFish
0 Replies

4. Shell Programming and Scripting

How to make variables in script function local?

Is it possible to make function variables local? I mean for example, I have a script variable 'name' and in function I have declared variable 'name' I need to have script's 'name' have the same value as it was before calling the function with the same declaration. The way to preserve a... (5 Replies)
Discussion started by: alex_5161
5 Replies

5. Linux

What are the meaning of these macros..

Masters, I am trying to learn the serial mouse driver for linux kernel. On the kernel source tree I find out these macros and I am unable to find out the meaning of these macros. Please anyone help me to understand these. These macros are defined in linux/serio.h... (2 Replies)
Discussion started by: iamjayanth
2 Replies

6. UNIX for Advanced & Expert Users

How to make the variables of one script available for the other scripts?

Hello Everyone, I want to know how can we make the variables of one script available for the other script? for example i have three scripts variable_availability.sh,first.sh,second.sh and a file containing variables called common ---------------------------------- cat variable_availability.sh... (2 Replies)
Discussion started by: Kesavan
2 Replies

7. Programming

help with atoi and macros in C

I have a PORT_NUM macro (10 digits long number) in a server file, if i do htons(PORT_NUM) i get warning: this decimal constant is unsigned only in ISO C90 warning: large integer implicitly truncated to unsigned type whats wrong with this? (2 Replies)
Discussion started by: omega666
2 Replies

8. UNIX for Dummies Questions & Answers

I need to make a constant variables to the root

Hello every body, I need to make a constant variable to the root such as #PS1="I am Amer" and so on. I know if i am a user,I can make it fixed from #vi .profile HOW to make it fixed for the root? Thanks in advance BR Ahmed Amer Cairo,Egypt (7 Replies)
Discussion started by: ahmedamer12
7 Replies

9. UNIX for Advanced & Expert Users

Script to make a table from Named Variables.

I need a shell script to make a table from Named Variables Input File(Can have multiple lines): a=1,b=2,d=4,e=5 a=11,b=12,c=13,d=14 Output file: a,b,c,d,e 1,2,,4,5 11,12,13,14, Thanks in advance (7 Replies)
Discussion started by: shariramani
7 Replies

10. Shell Programming and Scripting

Macros how-to?

Hi, all I just came to new system with RH, and it has alot of macros I was told to use, but I can't find how to open it for display or for edit, can you help me please, is it all about make/makefile? let say I have macro <trx> like this, that does a lot of things: >$ trx ... creating new... (1 Reply)
Discussion started by: trento17
1 Replies
URI::Template(3pm)					User Contributed Perl Documentation					URI::Template(3pm)

NAME
URI::Template - Object for handling URI templates (RFC 6570) SYNOPSIS
use URI::Template; my $template = URI::Template->new( 'http://example.com/{x}' ); my $uri = $template->process( x => 'y' ); # uri is a URI object with value 'http://example.com/y' DESCRIPTION
This module provides a wrapper around URI templates as described in RFC 6570: http://tools.ietf.org/html/rfc6570 INSTALLATION
perl Makefile.PL make make test make install METHODS
new( $template ) Creates a new URI::Template instance with the template passed in as the first parameter. template This method returns the original template string. variables Returns an array of unique variable names found in the template. NB: they are returned in random order. expansions This method returns an list of expansions found in the template. Currently, these are just coderefs. In the future, they will be more interesting. process( \%vars ) Given a list of key-value pairs or an array ref of values (for positional substitution), it will URI escape the values and substitute them in to the template. Returns a URI object. process_to_string( \%vars ) Processes input like the "process" method, but doesn't inflate the result to a URI object. AUTHORS
o Brian Cassidy <bricas@cpan.org> o Ricardo SIGNES <rjbs@cpan.org> COPYRIGHT AND LICENSE
Copyright 2007-2012 by Brian Cassidy This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-05-30 URI::Template(3pm)
All times are GMT -4. The time now is 04:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy