'system' and variables (newbie question) 
Author Message
 'system' and variables (newbie question)

I have the following (generic) 'exec' statement:

        exec $command -flag $value

where $command and $value are variables set by some previous 'set'
statement. What I want to do instead is using 'system', for the
sole reason that I want that exit code from my command. I.e. something
like
        system {$command -flag $value}

However, I have not been able to figure out how to do this with 'system'.
It seems that there is no variable substitution with 'system', so the
_variable_name_ arrives to the UNIX shell instead of the actual command.

What to do? Thanks in advance for any suggestions/hints.

Roland



Tue, 08 Jun 1999 03:00:00 GMT  
 'system' and variables (newbie question)


Quote:

>I have the following (generic) 'exec' statement:

>        exec $command -flag $value

>where $command and $value are variables set by some previous 'set'
>statement. What I want to do instead is using 'system', for the
>sole reason that I want that exit code from my command. I.e. something
>like
>        system {$command -flag $value}

>However, I have not been able to figure out how to do this with 'system'.
>It seems that there is no variable substitution with 'system', so the
>_variable_name_ arrives to the UNIX shell instead of the actual command.

                        .
                        .
                        .
Short answer:  you probably want

        system "$command -flag $value"

but I don't understand all of your question, so I'm
not sure.  Do you know about "catch"?  Does that give
you access to the return value from $command you want?
Is "system ..." something you've written?  Do you know
that the effect of "... {$...}" is to block variable
substitution?

I'll re-write <URL:http://starbase.neosoft.com/~claird/
comp.lang.tcl/fmm.html> over the coming weeks to make
some of this clearer.
--

Cameron Laird           http://starbase.neosoft.com/~claird/home.html

                        +1 713 996 8546 FAX



Sat, 12 Jun 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. newbie's variable reference question

2. (UNIX) Environment variables and 'system'

3. Real newbie question on 'mov'

4. Newbie question on 'cmpfiles':

5. Newbie question about 'cmpfiles'

6. $_GET variable variables, dynamic parsing (I'm not sure how to summarize this question)

7. un-'upvar'ing/un-'global'ing variables

8. question: 'A'..'k'

9. Beginner's 'enum' question

10. programming isn't about math Re: Newbie question re: circle and ellipse

11. Newbie question - what's the best forth?

12. Newbie's question: equivalent of .s for floating-point stack

 

 
Powered by phpBB® Forum Software