Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - More shell challenge: (4 Items)
   
More shell challenge  

OUTPUT="PROF=/dev/shmem/qprof"
$OUTPUT pterm program

This doesn't work as the shell will try to launch $OUTPUT which obviously doesnt work. I want it to just like if it 
would be:

PROF=/dev/shmem/qprof pterm <program>

Any idea how to achieve this.  Can't use extern.  The goal is for <program> to have PROF set accordingly.  I understand 
pterm would also get the variable but that's a non issue.

If pterm could support pterm PROF=... <program> that would have solved my problem ;-)
Re: More shell challenge  
On Fri, Aug 21, 2009 at 06:30:45PM -0400, Mario Charest wrote:
> 
> 
> OUTPUT="PROF=/dev/shmem/qprof"
> $OUTPUT pterm program
> 
> This doesn't work as the shell will try to launch $OUTPUT which obviously doesnt work. I want it to just like if it 
would be:
> 
> PROF=/dev/shmem/qprof pterm <program>
> 
> Any idea how to achieve this.  Can't use extern.  The goal is for <program> to have PROF set accordingly.  I 
understand pterm would also get the variable but that's a non issue.
> 
> If pterm could support pterm PROF=... <program> that would have solved my problem ;-)

Can you use the 'env' utility?

-seanb
RE: More shell challenge  

> -----Original Message-----
> From: Sean Boudreau [mailto:community-noreply@qnx.com]
> Sent: Friday, August 21, 2009 6:35 PM
> To: ostech-core_os
> Subject: Re: More shell challenge
> 
> On Fri, Aug 21, 2009 at 06:30:45PM -0400, Mario Charest wrote:
> >
> >
> > OUTPUT="PROF=/dev/shmem/qprof"
> > $OUTPUT pterm program
> >
> > This doesn't work as the shell will try to launch $OUTPUT which
> obviously doesnt work. I want it to just like if it would be:
> >
> > PROF=/dev/shmem/qprof pterm <program>
> >
> > Any idea how to achieve this.  Can't use extern.  The goal is for
> <program> to have PROF set accordingly.  I understand pterm would also
> get the variable but that's a non issue.
> >
> > If pterm could support pterm PROF=... <program> that would have
> solved my problem ;-)
> 
> Can you use the 'env' utility?
> 

  
I appears I sure can ;-)  Thanks Sean!  8 minutes for a response, after 5pm on a Friday.  You gotta love this place and 
the people behind it!


> -seanb
> 
> 
> 
> _______________________________________________
> 
> OSTech
> http://community.qnx.com/sf/go/post36464
> 
RE: More shell challenge  
On Fri, 2009-08-21 at 18:42 -0400, Mario Charest wrote:
> 
> > -----Original Message-----
> > From: Sean Boudreau [mailto:community-noreply@qnx.com]
> > Sent: Friday, August 21, 2009 6:35 PM
> > To: ostech-core_os
> > Subject: Re: More shell challenge
> > 
> > On Fri, Aug 21, 2009 at 06:30:45PM -0400, Mario Charest wrote:
> > >
> > >
> > > OUTPUT="PROF=/dev/shmem/qprof"
> > > $OUTPUT pterm program
> > >
> > > This doesn't work as the shell will try to launch $OUTPUT which
> > obviously doesnt work. I want it to just like if it would be:
> > >
> > > PROF=/dev/shmem/qprof pterm <program>
> > >
> > > Any idea how to achieve this.  Can't use extern.  The goal is for
> > <program> to have PROF set accordingly.  I understand pterm would also
> > get the variable but that's a non issue.
> > >
> > > If pterm could support pterm PROF=... <program> that would have
> > solved my problem ;-)
> > 
> > Can you use the 'env' utility?

Also, in situations where env is inappropriate, you can often use the
'eval' shell built-in, which is useful for running constructed commands.