Can anyone help me pass the directory choice in the script below to a variable? The language below came with the GTK Dialog examples in one of the puppy distros. I just want to pull out the directory choice into a variable and cd to that variable.
#!/bin/sh
GTKDIALOG=gtkdialog
funcbtnCreate() {
echo '<button>
<input file stock="gtk-'$2'"></input>
<action>fileselect:ent'$1'</action>
</button>'
}
MAIN_DIALOG='
<window title="Fileselect Advanced" resizable="false" width-request="500">
<vbox>
<vbox border-width="20" spacing="10">
<hbox>
<text label="folder" width-request="80"></text>
<entry fs-title="Select an existing folder" fs-action="folder">
<variable>ent3</variable>
</entry>
'"`funcbtnCreate 3 open`"'
</hbox>
</vbox>
<hseparator></hseparator>
<hbox homogeneous="true">
<button ok></button>
</hbox>
</vbox>
</window>
'
export MAIN_DIALOG
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
GTK
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
The easiest way is to remove the trailing case statement.
You don't have to assign the directory choice to a variable because it is already assigned (to variable ent3):
You don't have to assign the directory choice to a variable because it is already assigned (to variable ent3):
Code: Select all
.
.
.
export MAIN_DIALOG
eval $($GTKDIALOG --program=MAIN_DIALOG)
cd "$ent3"