Unix Programming - printf and make

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > printf and make





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author printf and make
Billy Patton

2004-01-29, 11:34 pm

In my make file I do

printf "$keep the dollar\n" > somefile

I've tried to do \$ $$ {$} but make still tries to sub the $

How can I prevent this?

I'm using GNU Make version 3.79.1
Built for sparc-sun-solaris2.7
But I'm running on sol8

___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455, b-patton@ti.com
=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=

2004-01-29, 11:34 pm

Billy Patton <bpatton@bright.dal.design.ti.com> writes:
quote:

> In my make file I do
>
> printf "$keep the dollar\n" > somefile
>
> I've tried to do \$ $$ {$} but make still tries to sub the $
>
> How can I prevent this?



$$ is the proper way to do it in the makefile. I suppose you want the
shell to expand the variable. Is that correct?

--
Måns Rullgård
mru@kth.se
Jens Schweikhardt

2004-01-30, 1:36 am

Billy Patton <bpatton@bright.dal.design.ti.com> wrote
in <Pine.GSO.4.58.0401300613200.22515@bright.dal.design.ti.com>:
# In my make file I do
#
# printf "$keep the dollar\n" > somefile
#
# I've tried to do \$ $$ {$} but make still tries to sub the $

If you want the $ end up in somefile, use

printf "\$$keep the dollar\n" > somefile

The shell will then see printf "\$keep the dollars\n" > somefile
You could as well use

printf '$$keep the dollar\n' > somefile



Regards,

Jens
--
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com