I am trying to do a delete function inside a zenity entry box . I would like to know how can I store the path given by the user inside the entry box in a variable or how can I use it . Thanks here is my code

#!/bin/bash function Ddate() { zenity --info \ --title "Date and Time" \ --text "Today is $(date)" } function Dcalendar() { zenity --calendar \ --title "Calendar" \ } function Ddelete() { zenity --entry \ --entry-text "Ex: home/knoppix/" \ --text "Enter a path" \ --title "Delete" \ } while true; do choice="$(zenity --height 275 --width 450 \ --list \ --title="Menu" \ --column="Function" --column="Description" \ Date 'Display the actual date and time.' \ Calendar 'Display an interactive calendar.' \ Delete 'Let you delete a file.' \ Exit 'To quit this script.')" case $choice in Date) Ddate;; Calendar) Dcalendar;; Delete) Ddelete;; Exit) break;; esac done 

1 Answer

Usually if you want insert the data in a variable from "zenity" you can try this example :

NAME=$( zenity --entry --text="type your name" ) if [ $? = 0 ] # check if the user click ok on the zenity form then echo "Hello $NAME" else echo "the user didn't click ok button" fi 

I hope this helps.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy