Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 08-16-2004, 04:00 PM   #16
Registered: Jun 2004
Location: New Zealand
Posts: 60

Original Poster
Rep: Reputation: 15

Thanks for all the replies and suggestions.

Old 08-16-2004, 06:50 PM   #17
Senior Member
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
The advanced bash scripting guide is a good online resource:

If you need something a little more basic try the Bash Guide for Beginners:
Old 08-16-2004, 07:19 PM   #18
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint
Posts: 9,707

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416

2) the history exansion problem you describe is real, but is only concerning interactive shells. Shell scripts shouldn't be affected.
Old 02-08-2007, 05:20 AM   #19
LQ Newbie
Registered: Feb 2007
Posts: 3

Rep: Reputation: 0
Cool [bash] new to bash, having problems debugging.

oops posted in wrong place.
Old 06-01-2013, 05:13 AM   #20
LQ Newbie
Registered: Jun 2013
Posts: 1

Rep: Reputation: Disabled
sh, ksh, and bash don't allow unquoted spaces in shell-variable assignments.
FILES=/usr/local/rpm /etc/samba /etc/httpd
will set FILES to "/usr/local/rpm" and then try to execute:
/etc/samba /etc/httpd
You can also put some '\' before the space to say "don't take care about what's following"
So you'll have:
FILES=/usr/local/rpm\ /etc/samba /etc/httpd

Sorry for my bad english :S
Old 06-02-2013, 06:32 AM   #21
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,826

Rep: Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973
Just to warn everyone, this is 9 year old necro-thread.

In the future, please consider whether what you want to add is important enough to justify re-opening a long-dead thread. Thanks.

While I'm here, I'm going to add my own comment though, and say that lists of filenames should not be stored in a single variable anyway. Always use arrays when you have multiple related strings to operate on.

files=( /usr/local/rpm /etc/samba /etc/httpd  )
printf 'This is file: %s\n' "${files[@]}"
Old 10-08-2013, 10:28 AM   #22
Registered: Oct 2013
Location: China
Distribution: Fefora 9
Posts: 77

Rep: Reputation: Disabled
Question I also have a similar question about 'fi'

if [ -d $(INSTDIR) ];\
cp myapp $(INSTDIR);\
chmod a+x $(INSTDIR)/myapp;\
chmod og-w $(INSTDIR)/myapp;\
echo "Installed in $(INSTDIR)";\
echo "sorry,$(INSTDIR) does not exist";\

run it and the error:syntax error near unexpected token 'fi'
but why? ican not find the reason.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
error: unexpected token `newline' CarlosV Programming 4 05-17-2011 03:47 AM
Many errors when 'make'ing (example: error: syntax error before `::' token) darkblade Linux - Software 5 03-02-2005 03:00 PM
got a syntax error which shows unexpected end of line when tried to run a shell scrip racer_mec Linux - Newbie 1 01-10-2005 01:43 AM
C++ syntax error before :: token HELP, i cant find the syntax error :( qwijibow Programming 2 12-14-2004 06:09 PM
Undecodable token error ?? Thymox Linux - General 3 11-18-2002 06:11 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:57 PM.

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