LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash: syntax error near unexpected token (https://www.linuxquestions.org/questions/linux-newbie-8/bash-syntax-error-near-unexpected-token-4175464594/)

rickmike45 06-03-2013 02:33 PM

bash: syntax error near unexpected token
 
Trying to update firefox and this is what I type and get. What does this mean and how can I fix it please.

[root@genesis firefox] # cp /root/Desktop/firefox-3.6.8(2).tar.bz
bash: syntax error near unexpected token '('

spazticclown 06-03-2013 02:45 PM

The command "cp" is the copy command, for that you need a source and destination specified. You only have a source "/root/Desktop/firefox-3.6.8(2).tar.bz". The copy command will not update firefox from a tarball and this version of firefox is very much out of date.

What distribution are you using, perhaps there is a build in package manager or command like yum or apt-get to update a pre-compiled version of the current firefox?

rickmike45 06-03-2013 02:57 PM

Would this work then (I know it's a very old version of firefox) and I am trying to use Fedora 18 and stay within the command line?

[root@genesis firefox] # cp /root/Desktop/firefox-3.6.8(2).tar.bz \opt\firefox
[root@genesis firefox] # tar firefox-3.6.8(2).tar.bz

spazticclown 06-03-2013 05:27 PM

Probably the best method is to use yum to update/install firefox.

Code:

# yum install firefox
as root will install firefox from the command line.

I also choose to live in the command line as much as possible, it is faster than trying to find known applications from a gui and more rewarding when something doesn't go terribly wrong.

PasBern 06-03-2013 06:09 PM

Quote:

Originally Posted by rickmike45 (Post 4964771)
[root@genesis firefox] # cp /root/Desktop/firefox-3.6.8(2).tar.bz \opt\firefox


Does that mean that you are running your desktop as root (logged in as root in the graphical login manager) and have downloaded the tar.gz file to your desktop via a browser? I'm asking because it is highly unusual to run GUI applications in whatever form or shape, be it a single program or a desktop environment, as root. From a security standpoint this is not recommended as far as I know. Please correct me somone in case I got this wrong. I do not mean to inconvenience you, it just looks strange, and as a complete newbie I have so far made many silly mistakes....:banghead:
Someone could have told me

yancek 06-03-2013 06:39 PM

Quote:

# cp /root/Desktop/firefox-3.6.8(2).tar.bz \opt\firefox
That won't work because you are not using windows. If you changed the destination to: /opt/firefox/ it should work. Check the link below for some simple instructions on extracting a tar.bz file:

http://www.cyberciti.biz/faq/tar-extract-linux/

jlinkels 06-03-2013 09:48 PM

The '(' and ')' are illegal characters in any bash command. So any command with using this file name will throw an error. You'd have to escape:
Code:

cp foo\(bar\) baz
when you want to copy foo(bar)

jlinkels


All times are GMT -5. The time now is 07:05 PM.