From: Ethan Mallove (ethan.mallove_at_[hidden])
Date: 2007-09-25 13:22:28


This issue was resolved by backslash-escaping the '&'.
So this works:

  alreadyinstalled_version = &shell("tcsh -c '@alreadyinstalled_dir@/bin/mpinfo -V |\& cut -d\" \" -f6-8'")

-Ethan

On Mon, Sep/17/2007 12:12:48PM, Ethan Mallove wrote:

> I am stuck trying to capture STDERR using &shell().
> I am able to capture it using tcsh, but since &shell()
> is sh-based, I need some sh-magic to get this working.
>
> tcsh $ mpinfo -V |& cut -d' ' -f6-8
> 10 Mar 2006
> bash-3.00$ /opt/SUNWhpc/HPC6.0/bin/mpinfo -V 2>&1 cut -d' ' -f6-8
> mpinfo: Sun HPC ClusterTools 6 10 Mar 2006 CRE 3.0
> bash-3.00$ tcsh -c '/opt/SUNWhpc/HPC6.0/bin/mpinfo -V |& cut -d" " -f6-8'
> 10 Mar 2006
>
> No luck using "tcsh -c" with &shell().
>
> Value: bogus
> Evaluating: &shell("tcsh -c '/opt/SUNWhpc/HPC6.0/bin/mpinfo -V |& cut -d\"
> \" -f6-8'")
> Replacing vars from section MTT: &shell("tcsh -c
> '/opt/SUNWhpc/HPC6.0/bin/mpinfo -V |& cut -d\" \" -f6-8'")
> --> Prefix now:
> --> Remaining (after &): shell("tcsh -c '/opt/SUNWhpc/HPC6.0/bin/mpinfo -V
> |& cut -d\" \" -f6-8'")
> --> Found func name: shell
> --> Found beginning of arguments: "tcsh -c '/opt/SUNWhpc/HPC6.0/bin/mpinfo
> -V |& cut -d\" \" -f6-8'")
> --> Initial param search: "tcsh -c '/opt/SUNWhpc/HPC6.0/bin/mpinfo -V |&
> cut -d\" \" -f6-8'")
> --> Loop: trimmed search: "tcsh -c '/opt/SUNWhpc/HPC6.0/bin/mpinfo -V |&
> cut -d\" \" -f6-8'")
> --> Examining char: " (pos 0)
> --> Found beginning quote
> --> Found last quote
> --> Examining char: ) (pos 66)
> --> Found end of arg (pos 66)
> Found argument: "tcsh -c '/opt/SUNWhpc/HPC6.0/bin/mpinfo -V |& cut -d\" \"
> -f6-8'"
> --> Remainder:
> --> Calling: $ret = MTT::Values::Functions::shell("tcsh -c
> '/opt/SUNWhpc/HPC6.0/bin/mpinfo -V |& cut -d\" \" -f6-8'");
> &shell: got tcsh -c '/opt/SUNWhpc/HPC6.0/bin/mpinfo -V |& cut -d" " -f6-8'
> &shell: returning
> --> After eval(string), remaining:
> Replacing vars from section MTT:
> Got final version before escapes:
>
> ???
>
> -Ethan
>
> _______________________________________________
> mtt-users mailing list
> mtt-users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/mtt-users