chmod: 1: Syntax error: "(" unexpected - what's this mean and how do I fix it?
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
chmod: 1: Syntax error: "(" unexpected - what's this mean and how do I fix it?
Some background:
I' hacking a series 1 tivo. One of the things to do is create a file (rc.sysinit.author) and chmod it so it is executable. I am in the directory where the file is, and enter this:
/mnt7/bin/chmod: 755 rc.sysinit.author
and I get this error:
chmod: 1: Syntax error: "(" unexpected
I'm no dummy. I stared with a digicomp1 in the late 60's, passed through the ZXZ81-C64-cp/m-8088-8086-80286-etctera-etcetera, fiddle with pics, am completely comfortable with a command line, and so on. I am, however, new to Linux.
I have done quite a bit of googling to try to find what this error means, but have had no luck.
There is a possible hint in that the directions I'm following said to just enter:
chmod 755 rc.sysinit.author
but that gave me another error:
chmod: not found
which I could figure out how to fix, as above, by declaring the entire path in the command. Because of this, I have tried a number of variations on the chmod command - things like using +x instead of 755, including the whole filename with path for the rc.sysinit.author file, changing to the /mnt/bin directory and doing ./chmod 755 /the-whole-filepath-for-the-rc.sysyinit.author file. No luck.
I suppose I could edit the rc.sysinit file (runs first, then calls my file) which has the executable bit set but would rather know how to chmod.
Distribution: OpenSuse 10.3, SLED 10 SP2, Ubuntu 8.04 and 9.04
Posts: 23
Rep:
Command 'chmod 755 myfile' should work if path is set so that it contains /mnt7/bin and you own the file. Traditionally directory bin is under root so '/bin/chmod 755 myfile'. Check path by typing 'path'.
I am curious about the error you get from the first command, tho. You said you tried using other flags but did you try to run chmod on another file or directory than rc.sysinit.author? Cause otherwise it may be something odd with your chmod binary.
I have never worked on a Tivo before but if the rc.sysinit.author file is inside /mnt7 you could try to chroot into /mnt7 and try again.
Shouldn't it be /mnt7/bin/chmod 755 rc.sysinit.author ?
Hmmm, this forum quoting thingy doesn't quote everything. I'm more used to usenet. I'm goint to preface you stuff with >
Yes, of course; there was no colon in the line I actually typed.
>This means that chmod is not in your path.
>Check your path with
echo $path gives a blank, which is why (I think) that typing the path + filename for chmod seemd to get chmod to work, instead of a not found error.
>I am curious about the error you get from the first command, tho. You >said you tried using other flags but did you try to run chmod on >another file or directory than rc.sysinit.author? Cause otherwise it >may be something odd with your chmod binary.
Just did that - made another file ("test") with the joe editor (looks exactly like VDE for cp/m) and
tried /mnt7/bin/chmod 755 test
- got the same error:
/mnt7/bin/chmod: 1: Syntax error: "(" unexpected
>I have never worked on a Tivo before but if the rc.sysinit.author file >is inside /mnt7 you could try to chroot into /mnt7 and try >again.
I don't seem to have a chroot command - went poking about in the directories but didn't find it. Just typing
Try 'file /mnt7/bin/chmod' - I'm trying to figure out how you can get an error that has nothing to do with your command and all I can think of is that your chmod is a shell script, for some reason, with a syntax error in it or something.
I have no idea about a tivo, though. Why 'mnt7'? Why is your path not reasonable? Etc. I'd go ahead and set a path with all the usual '*bin's and whatever unusual places I could think of but, like I say, 'tivo?'
-- Oh yeah - I dunno what all you're up to, so this may not suffice but you can run a script that isn't executable by giving it as an argument to your shell - $SHELL rc.sysinit.author. So if you absolutely can't get it chmod'ed, you can still run it. But if things are that weird there'd be a lot more to fix than just running the file.
Last edited by slakmagik; 02-22-2008 at 10:01 AM.
Reason: late thought
Try 'file /mnt7/bin/chmod' - I'm trying to figure out how you can get an error that has nothing to do with your command and all I can think of is that your chmod is a shell script, for some reason, with a syntax error in it or something.
I have no idea about a tivo, though. Why 'mnt7'? Why is your path not reasonable? Etc. I'd go ahead and set a path with all the usual '*bin's and whatever unusual places I could think of but, like I say, 'tivo?'
-- Oh yeah - I dunno what all you're up to, so this may not suffice but you can run a script that isn't executable by giving it as an argument to your shell - $SHELL rc.sysinit.author. So if you absolutely can't get it chmod'ed, you can still run it. But if things are that weird there'd be a lot more to fix than just running the file.
Well, I dunno about paths and shell scripts and so on...
One of the steps is to tell the tivo to start a telnet server when it boots. They advise you not to edit the rc.sysinit file as there is a lot of critical stuff there; but to edit the file that it supposedly looks for and hands off to if it exists - i.e. rc.sysinit.author.
I worked around it, sort of.
I copied the rc.sysinit file which has the correct permissions to re.sysinit.bak; then edited THAT file, then rm'd the rc.sysinit.author that could not be chmod'ed, then copied the rc.sysinit.bak to rc.sysinit.author.
LS -l shows all the correct permissions now.
Now I'm fighting with the ethernet adapter and trying to see if the telnet command (which is what in rc.sysinit.author) works. Sometimes my router gives the adapter an IP and sometimes not, and I have not yet seen a prompt over telnet. It's a pain not having a screen to look at what's going on in the box: take drive out, attach to extra pc, boot pc, edit file, put drive in tivo, boot tivo, wait and talk to router, try to telnet...; repeat ad inf.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.