Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-27-2016, 02:16 PM
|
#1
|
LQ Newbie
Registered: Nov 2016
Posts: 5
Rep:
|
Zenity script help
Hello I am trying to make a zenity program that has to answer these questions.
http://i67.tinypic.com/2qwmvx5.jpg
Here is the code so far Im really confused:
Code:
#!/bin/bash
start=1
while [ $start=1 ]
do
P1=$(zenity --forms --text "Employment Information" --title= "Employment Information" --add-entry="Employee Full name" --add-entry="Employee Username" --add-calendar="Date of Birth" --add-list="Select Department" --list-values="HUMAN RESOURCE|FINANCE|SALES|INFOTECH|LOGISTICS" --add-password="Password:" --add-combo="Select Education" --combo-values="Grade 12|Diploma|Adv. Diploma|Graduate|Masters" --separator=: >> emplist.txt)
P2=$(zenity --list --checklist --title="Technicial Certifications" --text="Select cerifications achieved:" --column="Acquired" --column="Certifications" FALSE "RHCSA" FALSE "RHCSE" FALSE "MCSA" FALSE "CCNA" FALSE "CCNP" FALSE "ITIL" FALSE "PMP" >> emplist.txt)
P3=$(zenity --list --title "Drivers License" --text "Select Drivers License level: " --radiolist --column "Acquired/Passed" --column "License level" FALSE "G1" FALSE "G2" FALSE "G" >> emplist.txt)
P4=$(zenity --question --title " " --text "Make another account")
P5=$(zenity --text-info --filename="emplist.txt")
done
In short I need to:
-Make the name inputted in the first entry of the first zenity form prompt appear on the question prompt (P4)
-When I say No on the question prompt(P4) it should redirect me to P5 to show emplist.txt
-When I say yes on the question prompt(P4) it should redirect back to P1 to make another account
-Ok/Cancel should close P5 when pressed
-P2 and P3 should stdout to emplist.txt WITHOUT making a new line and adding to P1s line
Thank you so much
Last edited by zvlo; 11-27-2016 at 10:10 PM.
|
|
|
11-27-2016, 10:16 PM
|
#2
|
LQ Newbie
Registered: Nov 2016
Posts: 5
Original Poster
Rep:
|
Hello
I made this code for a zenity program and need help accomplishing some tasks.
In short I need to:
-Make the name inputted in the first entry of the first zenity form prompt appear on the question prompt (P4)
-When I say No on the question prompt(P4) it should redirect me to P5 to show emplist.txt
-When I say yes on the question prompt(P4) it should redirect back to P1 to make another account
-Ok/Cancel should close P5 when pressed
-P2 and P3 should stdout to emplist.txt WITHOUT making a new line and adding to P1s line
Here is the code (I am really confused):
Code:
#!/bin/bash
start=1
while [ $start=1 ]
do
P1=$(zenity --forms --text "Employment Information" --title= "Employment Information" --add-entry="Employee Full name" --add-entry="Employee Username" --add-calendar="Date of Birth" --add-list="Select Department" --list-values="HUMAN RESOURCE|FINANCE|SALES|INFOTECH|LOGISTICS" --add-password="Password:" --add-combo="Select Education" --combo-values="Grade 12|Diploma|Adv. Diploma|Graduate|Masters" --separator=: >> emplist.txt)
P2=$(zenity --list --checklist --title="Technicial Certifications" --text="Select cerifications achieved:" --column="Acquired" --column="Certifications" FALSE "RHCSA" FALSE "RHCSE" FALSE "MCSA" FALSE "CCNA" FALSE "CCNP" FALSE "ITIL" FALSE "PMP" >> emplist.txt)
P3=$(zenity --list --title "Drivers License" --text "Select Drivers License level: " --radiolist --column "Acquired/Passed" --column "License level" FALSE "G1" FALSE "G2" FALSE "G" >> emplist.txt)
P4=$(zenity --question --title " " --text "Make another account")
P5=$(zenity --text-info --filename="emplist.txt")
done
Thank you so much
Last edited by zvlo; 11-28-2016 at 10:08 AM.
|
|
|
11-27-2016, 10:17 PM
|
#3
|
LQ Newbie
Registered: Nov 2016
Posts: 5
Original Poster
Rep:
|
If anymore screenshots are needed about the zenity programs like P1, P2 and P3 please let me know or just run them yourself they work
|
|
|
11-28-2016, 07:21 AM
|
#4
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep:
|
When is the test?
|
|
|
11-28-2016, 08:09 AM
|
#5
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,938
|
Per the LQ Rules, please do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and Google searches) and we'll do our best to help. Also, keep in mind that your instructor might also be an LQ member.
|
|
|
11-28-2016, 10:09 AM
|
#6
|
LQ Newbie
Registered: Nov 2016
Posts: 5
Original Poster
Rep:
|
Quote:
Originally Posted by Habitual
When is the test?
|
Quote:
Originally Posted by rtmistler
Per the LQ Rules, please do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and Google searches) and we'll do our best to help. Also, keep in mind that your instructor might also be an LQ member.
|
Habitual - Its an assignment lol
rtmistler - Okay I deleted the original pictures of the questions and just left the questions I have about the code.
|
|
|
11-28-2016, 11:48 AM
|
#7
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,938
|
What you've written is not a working script, it is a handful of variable assignments and nothing further.
You need to determine how you can see the output of your first zenith command, to get it to the shell script. Once you know that, you can assign that to a variable and test the variable. You may end up needing to save it to a variable using some other means, for instance capturing the data from stdin as a user enters it.
My signature has a few BASH script references to aid you in better understanding BASH scripting. I also have a blog entry which talks about some ways to debug your scripts.
Some suggestions are to (1) remove the loop and all the following commands and just worry about the first command (2) remember that anything you can type and run from the terminal command line, you can put into a BASH script, and likewise any returns or status you get back you can save as a variable and test withing the BASH script (3) please put in some additional effort to find out how to get the desired output from your first command, I do not have or use zenith and therefore can only assess the flow of your script, which as I've said presently, does not have a flow, it is instead an infinite loop of variable definitions.
To be more effective, you may wish to review the information on good question guidelines for LQ, as well.
|
|
|
11-28-2016, 11:52 AM
|
#8
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep:
|
|
|
|
All times are GMT -5. The time now is 09:55 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|