Re: if question
From: Charles Heizer (cheizer_at_sbcglobal.net)
Date: 02/23/04
- Next message: Bob Techentin: "Re: How to create an interactive command line application?"
- Previous message: John Seal: "Dr. Dobb's Tcl-URL! - weekly Tcl news and links (Feb 23)"
- In reply to: Bryan Oakley: "Re: if question"
- Next in thread: Bruce Hartweg: "Re: if question"
- Reply: Bruce Hartweg: "Re: if question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 23 Feb 2004 19:07:19 GMT
Hello,
Thanks for all of the suggestions, but none of them worked.
I tried the suggestions outside of my script and they work fine, I think
the real problem has to do with the command line application I'm calling .
Thanks for everyone's help.
- Charles
Bryan Oakley wrote:
> Charles Heizer wrote:
>
>> hello,
>> how can I put a if statement on one line?
>>
>> example --
>> if {$noprompt == "-noprompt"} {$noprompt}
>
>
> Taking the question literally, the answer is almost identical to your
> example:
>
> if {$noprompt == "-noprompt"} {do whatever you want}
>
> If what you're really after is in the spirit of your example you
> probably want something like this:
>
> expr {$noprompt == "-noprompt" ? $noprompt : ""}
>
> In and of itself that's pretty useless since the returned value is
> thrown away. Perhaps you mean this:
>
> set noprompt [expr {$noprompt == "-nooprompt" ? $noprompt : ""}]
>
> Though, if that is the goal, why not this:
>
> if {$noprompt != "-noprompt"} {set noprompt ""}
>
>
> Do any of the above meet your needs? What exactly are you trying to
> accomplish?
>
- Next message: Bob Techentin: "Re: How to create an interactive command line application?"
- Previous message: John Seal: "Dr. Dobb's Tcl-URL! - weekly Tcl news and links (Feb 23)"
- In reply to: Bryan Oakley: "Re: if question"
- Next in thread: Bruce Hartweg: "Re: if question"
- Reply: Bruce Hartweg: "Re: if question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|