Unexpected "(" (expecting "}")


Login or Register to Reply

 
Thread Tools Search this Thread
# 9  
Old 2 Days Ago
Quote:
Are you getting the same error on line 46 of this script?
Code:
LibreELEC:~ # /bin/bash /storage/.config/test
/storage/.config/test: line 46: syntax error: unexpected "(" (expecting "}")

Quote:
And sh doesn't have arrays
That's what I wrote in my second post.

Quote:
Does your busybox version really offer bash?
I only said that bash is installed
but after I read Corona's comment

Quote:
That's just a convenience alias
I doublechecked and bash --version really results in an empty line.
So is it true that busybox offers a fake bash command? That's irritating (as well as the error message)

LibreElexc is compiled from scratch, where the contend is controlled by package descriptions. There definitely is a package for bash 4.3.46 but obviously it wasn't compiled and installed. I'll have to look into this.

So if this
Code:
Currently defined functions:
        ar, arch, arp, arping, ash, awk, basename, bash

is just a limited bash version and there is no way to change the code of the script because busybox offers no arrays then this problem should be "solved". Learning never stops.
I thank you all for your efforts and useful contributions.
# 10  
Old 2 Days Ago
Quote:
Originally Posted by ACorner
So is it true that busybox offers a fake bash command? That's irritating (as well as the error message)
It's kind of a "boy who cried wolf" situation. bash and sh are so synonymous in the linux world, it's difficult to convince authors to type #!/bin/sh whenever #!/bin/bash wasn't needed. On many systems, they're the exact same thing anyway, they have no "minimal" shell to even test with.

But in a system with 2 megs of storage and 4 megs of RAM, bash is a "hog". Many hundreds of kilobytes could be saved by using a more minimal shell. So they install busybox, plus the link to make these "bash" scripts run on vanilla sh, which is usually enough to work, sometimes with a minor modification or two.

Of course, on the rare occasion these "bash" scripts actually need bash, you get this.
# 11  
Old 1 Day Ago
I fully understand why busybox is used on systems like JustEnoughOSes, after all that's the reason why I use LibreElec.
But it would be very helpfull if at least error messages would give a tiny hint that it's busybox that produces that error and not bash. It's not obvious that if you type an explicit command like /bin/bash that you end up in a "fake" version.
But that' another story.
# 12  
Old 1 Day Ago
Quote:
Originally Posted by ACorner
I fully understand why busybox is used on systems like JustEnoughOSes, after all that's the reason why I use LibreElec.
But it would be very helpfull if at least error messages would give a tiny hint that it's busybox that produces that error and not bash. It's not obvious that if you type an explicit command like /bin/bash that you end up in a "fake" version.
But that' another story.
I fully agree with you there. Note that if you were using a real bash, any diagnostic messages that it produces would include "bash:" at the start of the message. For example if I issue the command:
Code:
bash -c 'for i in *;do { cat "$i'

on macOS, I get two diagnostics:
Code:
bash: -c: line 0: unexpected EOF while looking for matching `"'
bash: -c: line 1: syntax error: unexpected end of file

each of which clearly indicates that the diagnostic came from bash (the first indicating that it is looking for a missing <double-quote> character and the second indicating that it is looking for a missing } and/or a missing done). This is why we asked you to be sure that you were showing us the exact, complete diagnostic messages you were getting when you reported the problem.

If the tools provided by busybox don't do that for you, you'll have a hard time trying to guess if the diagnostics you're seeing are coming from the shell or from one of the utilities invoked by the shell. This makes diagnosing problems in an environment like that much more difficult for you. I wish you luck.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9" jcdole Shell Programming and Scripting 1 4 Weeks Ago 06:37 AM
Expect: spawn id exp5 not open while executing "expect "$" { send "sudo su -\r" }" Siddharth shivh Shell Programming and Scripting 3 05-31-2018 11:46 AM
find . -path "*_nobackup*" -prune -iname "*.PDF" \( ! -name "*_nobackup.*" \) wolfv Shell Programming and Scripting 3 07-16-2017 04:17 AM
Using "mailx" command to read "to" and "cc" email addreses from input file asjaiswal UNIX for Dummies Questions & Answers 2 10-11-2014 10:32 PM
Find lines with "A" then change "E" to "X" same line nightwatchrenba Shell Programming and Scripting 10 08-28-2013 06:00 AM
grep with "[" and "]" and "dot" within the search string jcdole Shell Programming and Scripting 4 10-09-2012 06:32 AM
The slices "usr", "opt", "tmp" disappeared!!! Help please. wolfgang Solaris 16 05-25-2012 09:09 AM
how to use "cut" or "awk" or "sed" to remove a string timmywong Shell Programming and Scripting 8 02-12-2012 12:55 PM
awk command to replace ";" with "|" and ""|" at diferent places in line of file shis100 Shell Programming and Scripting 7 03-16-2011 09:59 AM
Make scipt except from "Y","y" and "yes" to take [Enter] as being "yes" hakermania Shell Programming and Scripting 4 12-11-2010 10:24 AM
ps -ef | grep "string1" "string2" " "string3" steve2216 Shell Programming and Scripting 11 09-03-2010 12:08 PM
cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' harshakusam Shell Programming and Scripting 4 08-25-2009 12:21 PM
Syntax error: word unexpected (expecting ")") figaro Shell Programming and Scripting 9 03-06-2009 03:18 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM