quouteing(?) problems in rc - Plan9

This is a discussion on quouteing(?) problems in rc - Plan9 ; Greetings, I am using rc from plan9port on Linux and I am trying to construct a grep command. This is what I have so far: file = nibsRouteMib.erl func = create_ok echo grep -n -e '''' ^ '^' ^ $func ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: quouteing(?) problems in rc

  1. quouteing(?) problems in rc

    Greetings,

    I am using rc from plan9port on Linux and I am trying to construct a grep
    command. This is what I have so far:

    file = nibsRouteMib.erl
    func = create_ok
    echo grep -n -e '''' ^ '^' ^ $func ^ '''' $file /dev/null
    grep -n -e '''' ^ '^' ^ $func ^ '''' $file /dev/null

    The echo is only there to test what the command looks like. If I run
    the above lines I get:

    grep -n -e '^create_ok' nibsRouteMib.erl /dev/null
    file: exit 1


    If I run the line I got from the echo (grep -n -e '^create_ok'
    nibsRouteMib.erl /dev/null) I get:

    nibsRouteMib.erl:522: create_ok( Row_index, _Columns ) ->


    Since the echo'ed line works fine but not the very similar line below, I
    must have made a mistake somewhere and wonder if somebody can spot it and
    tell me?


    bengt

    --
    Those were the days...
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."

  2. Re: [9fans] quouteing(?) problems in rc

    > grep -n -e '''' ^ '^' ^ $func ^ '''' $file /dev/null

    your problem is that you're constructing a list containing quotes
    suitable for input to the shell, but you really want to construct
    a list containing values suitable for arguments to grep.
    i think what you want is:

    grep -n -e '^'^$func $file /dev/null

    which of course will only work correctly if $func contains no
    regexp metacharacters, but i'm sure you know that.

+ Reply to Thread