[SOLVED] pass data in variable

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
arivas_2005
Posts: 212
Joined: Sun 25 Feb 2007, 14:39

[SOLVED] pass data in variable

#1 Post by arivas_2005 »

how I can pass the variable ENTRY1 of a box to another.

Using the following code:

Code: Select all

#! /bin/bash
export MAIN_DIALOG='
 <vbox>
  <entry>
    <default>"Default value"</default>
    <variable>ENTRY1</variable>
  </entry>
  <hbox>
   <button ok></button>
   <button cancel></button>
  </hbox>
 </vbox>
'

gtkdialog --program=MAIN_DIALOG


export MAIN_DIALOG1='
 <vbox>
  <text>
    <label>text:   "'$ENTRY1'"</label>   
  </text>
  <hbox>
   <button ok></button>
   <button cancel></button>
  </hbox>
 </vbox>
'

gtkdialog --program=MAIN_DIALOG1

digit text in gtkdialog1 to see in gtkdialgo2, using the variable ENTRY1

How in the line
<label>text: "'$ENTRY1'"</label>
falls

Greetings
Last edited by arivas_2005 on Tue 27 Nov 2012, 14:49, edited 1 time in total.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#2 Post by SFR »

Evaluating will do the job in that case:

Code: Select all

#! /bin/bash

export MAIN_DIALOG=' 
 <vbox> 
  <entry> 
    <default>"Default value"</default> 
    <variable>ENTRY1</variable> 
  </entry> 
  <hbox> 
   <button ok></button> 
   <button cancel></button> 
  </hbox> 
 </vbox> 
' 

I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog --program=MAIN_DIALOG); do
  eval $STATEMENTS
done
IFS=$I

export MAIN_DIALOG1=' 
 <vbox> 
  <text> 
    <label>text:   "'$ENTRY1'"</label>    
  </text> 
  <hbox> 
   <button ok></button> 
   <button cancel></button> 
  </hbox> 
 </vbox> 
' 

gtkdialog --program=MAIN_DIALOG1
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

arivas_2005
Posts: 212
Joined: Sun 25 Feb 2007, 14:39

#3 Post by arivas_2005 »

excelent. thanks

Post Reply