Linux - NewbieThis 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.
Hi
I want to figure out what is going on in this small script.Its really strange.I think its the infinite loop again.All I want to do is to collect some data from the zenity dialog box in an array and then echo it.
Here is the code
Code:
#!/bin/bash
#export PS4='+${BASH_SOURCE}:${LINENO}:${FUNCNAME[0]}: ' debugging info
IFS_OLD= $IFS
#IFS=':'
result
function pageInfo {
local num
arr_local
for (( i=0 ; i<5 ; i++ ))
do
while true
test_param= $(zenity --entry --text "Please enter $param for the webpage")
if [[ -n "$test_param" && "$?" -eq 0 ]] ; then
arr_local["$num"]=$test_param
(( num++ ))
break
fi
done
done
echo ${arr_local[@]}
}
result=(`pageinfo`)
echo "$result"
#EOF
You did not provide many details about what you got from running this script (error messages, unpredictable results and so on). Anyway, two syntax errors come at first sight:
Code:
IFS_OLD= $IFS
and
Code:
test_param= $(zenity --entry --text "Please enter $param for the webpage")
In assignments there must not be extra spaces around the equal sign. It should be:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.