getopts may help here

https://unix.stackexchange.com/questions/675415/handling-long-options-with-getopts

https://labex.io/tutorials/shell-bash-getopt-391993


On 9/9/25 2:13 PM, ToddAndMargo via users wrote:
On 9/9/25 12:42 PM, C. Linus Hicks wrote:
From: ToddAndMargo <[email protected]>
Hi All,

I know how to do this in Raku (Perl 6), but how do I assist the return values of this zenity call inside a bash script to separate variables?

$ zenity --forms --title="Create user" --text="Add new user" --add-entry="First Name" --add-entry="Last Name" --add-entry="Username" --add-password="Password" --add-password="Confirm Password" --add-calendar="Expires"

aaa|bbb|ccc|ddd|ddd|09/10/2025


You could, for instance, assuming a small number of return arguments:

$ retVal=$(zenity --forms --title="Create user" --text="Add new user" --add-entry="First Name" --add-entry="Last Name" --add-entry="Username" --add-password="Password" --add-password="Confirm Password" --add-calendar="Expires")

$ v1=$(echo $retVal | cut -d\| -f1)
$ v2=$(echo $retVal | cut -d\| -f2)
  $ v3=$(echo $retVal | cut -d\| -f3)
$ v4=$(echo $retVal | cut -d\| -f4)
$ v5=$(echo $retVal | cut -d\| -f5)
$ v6=$(echo $retVal | cut -d\| -f6)


Thank you!

--
_______________________________________________
users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to