LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-08-2010, 05:52 PM   #1
denneyd
LQ Newbie
 
Registered: Apr 2010
Location: Portland, Oregon
Distribution: SuSE 11x
Posts: 3

Rep: Reputation: 0
Unhappy bash: syntax error


Using SuSE 11.2, as root. The command rm <file> where file is VMware-Workstation-Full-7.0.1-227600.i386(2).bundle gives error message "bash: syntax error near unexpected token '(' ". I am unable to delete the <file>.
 
Old 04-08-2010, 06:02 PM   #2
roreilly
Member
 
Registered: Aug 2006
Location: Canada
Distribution: Debian, Slackware
Posts: 106

Rep: Reputation: 28
the ( and ) are special characters, and treated differently by bash than regular alphanumerics.

try doing a mv to rename the file & take out the brackets, then rm.

or, escape the brackets by preceding each one with \ eg:

VMware-Workstation-Full-7.0.1-227600.i386\(2\).bundle

I hope this helps.
 
Old 04-08-2010, 06:17 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Code:
[mherring@mystical play]$ touch filename(2)
bash: syntax error near unexpected token `('
[mherring@mystical play]$ touch "filename(2)"
[mherring@mystical play]$ ls
cmp1  cmp2  col  filename(2)  gr
[mherring@mystical play]$ rm fil*
[mherring@mystical play]$ ls
cmp1  cmp2  col  gr
[mherring@mystical play]$ touch "filename(2)"
[mherring@mystical play]$ rm filename(2)
bash: syntax error near unexpected token `('
[mherring@mystical play]$ rm "filename(2)"
[mherring@mystical play]$
So, it can be removed using a wildcard--or by quoting
 
Old 04-08-2010, 08:41 PM   #4
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora, Centos, Manjaro
Posts: 317

Rep: Reputation: 70
The other useful thing in bash is "file name completion" accessed by using the TAB key in the shell.

For example:-

# rm VM(press TAB key here)

will expand any file starting with the letters VM. If there are multiple files staring with VM, pressing TAB again will give you a list of matching filenames.

The beauty of this is that bash will put in the escape characters (\) for you so you don't have to type them in yourself.
 
  


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
Bash Error: syntax error near unexpected token `{ araouf Linux - Newbie 1 03-04-2010 04:43 PM
syntax error in bash tugce_zehra Linux - Newbie 2 12-05-2008 09:59 AM
bash, syntax error santana Linux - Software 2 01-23-2008 01:39 PM
BASH : syntax error semaja2 Programming 6 01-26-2006 12:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:46 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