groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using .so in a macro


From: Ralph Corderoy
Subject: Re: using .so in a macro
Date: Thu, 16 Feb 2023 10:05:15 +0000

Hello Riza,

> Is it possible to use the ".so" command in a macro, and pass in an
> argument from the macro.
>
> .de MC
> .so \\\\$1
> ..
>
> .MC file.txt

Yes.

    $ cat >foo
    .de source
    .so \\$1
    ..
    foo        
    .source bar
    foo
    ^D
    $
    $ cat >bar
    bar
    ^D
    $
    $ nroff foo | grep .
    foo bar foo
    $

You're escaping the ‘$’ too much.  You're seeing:

    $ nroff foo | grep .
    troff: foo:5: can't open '\$1': No such file or directory
    foo foo
    $

-- 
Cheers, Ralph.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]