help with macros

Help
2011-04-22
2013-05-15
  • Norman Walker
    Norman Walker
    2011-04-22

    Hello,

    Hopefully this posting works, I am having problems getting shell_command to work, I have searched and searched the internet, but cannot find my issue.

    Here is my macro:
    define verilog_todo
    {
      d=shell_command("date +'+%m/%d/%y'", "")
      d=substring(d, 0, length(d)-1)
    u=shell_command("echo $USER", "")
      u=substring(u, 0, length(u)-1)
      columns = $column
      insert_string( "// TODO - " )
      insert_string( d )
      insert_string( " - " )
      insert_string( u )
      insert_string( " - " )
      position_end = $cursor
      insert_string( " \n" )
      set_cursor_pos( position_end )
    }

    it should produce this:
    // TODO - 3/19/11 - nwalker - <and move the cursor here>

    but instead I get this:
    // TODO - complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    set: Variable name too long
    +03/19/11 - complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    complete: Command not found
    set: Variable name too long
    nwalker - 

    I guess one option is to strip out everything but the last line, but this is such a pain.  How do you get shell_command to work?  Every example I see on the internet is just like I have used 

    Norm