LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-10-2014, 10:32 PM   #1
0000
LQ Newbie
 
Registered: Apr 2014
Posts: 1

Rep: Reputation: Disabled
Why is bash giving me errors on a script i wrote when it shouldn't


I am writing a simple organizer

Here is the code:
aaaa=`zenity --list --title="simple organizer" --text="Welcome! What would you like to do?"` --column=Action "Make a notebook"`
if [ "$aaaa" == "Make a notebook" ]
then
1=`zenity --entry --title="simple organizer" --text="What do you want to call it?"`
cd ./notebooks
#mkdir "$1"
#cd "$1"
blah=`zenity --list --title="simple organizer" --text="Would you like to make a new page? Or leave it blank?" --column=Action "New page" "Leave it blank"`
zenity --text=Test

it isn't functional yet it just displays test messages. But these are the errors:

./organizer.sh: line 8: unexpected EOF while looking for matching ``'
./organizer.sh: line 10: syntax error: unexpected end of file

and no i do not have a space at the end i tried clicking there and the cursor didnt move. arrowing also did nothing.
What am i doing wrong?
 
Old 04-10-2014, 10:57 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
The preferred method these days is to use '$()' instead of backticks, however if you use an editor with syntax highlighting you'll quickly see the issue/s:

Code:
aaaa=`zenity --list --title="simple organizer" --text="Welcome! What would you like to do?"` --column=Action "Make a notebook"`
if [ "$aaaa" == "Make a notebook" ]
then
 1=`zenity --entry --title="simple organizer" --text="What do you want to call it?"`
 cd ./notebooks
 #mkdir "$1"
 #cd "$1"
 blah=`zenity --list --title="simple organizer" --text="Would you like to make a new page? Or leave it blank?" --column=Action "New page" "Leave it blank"`
 zenity --text=Test
fi
You have an extra backtick in the middle of the first line and you're missing a 'fi' to end the 'if' block.

<edit>Also, when pasting code please use code tags so we can see the layout, I have no idea where your if block was supposed to end</edit>

Last edited by kbp; 04-10-2014 at 11:00 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
xml_grep from bash script giving errors on var. brizey Linux - Software 1 08-16-2010 04:55 AM
Bash script giving unexpected end of file ewebza Programming 4 04-24-2010 08:50 PM
chkdns / Questions about bash and sharing a script I wrote.... frater Programming 6 03-20-2010 10:47 AM
simple bash script errors cbtsig215 Linux - Newbie 4 12-04-2009 03:33 AM
Bash script has errors smeezekitty Programming 30 11-19-2009 03:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration