Syntax error: Bad substitution
I'm getting the following error when running dosemu 1.2.2 under a newly installed Kubuntu 6.10:
./xdosemu: 86: Syntax error: Bad substitution
What might be going on here?
Quoted 6 lines · Ralph Alvy
I'm getting the following error when running dosemu 1.2.2 under a newly installed Kubuntu 6.10:
./xdosemu: 86: Syntax error: Bad substitution
What might be going on here?
Here are the last few lines of 'strace xdosemu':
fcntl64(10, F_SETFD, FD_CLOEXEC) = 0rt_sigaction(SIGINT, NULL, {SIG_DFL}, 8) = 0 rt_sigaction(SIGINT, {0x8054c2e, ~[RTMIN RT_1], 0}, NULL, 8) = 0 rt_sigaction(SIGQUIT, NULL, {SIG_DFL}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL}, NULL, 8) = 0 rt_sigaction(SIGTERM, NULL, {SIG_DFL}, 8) = 0 rt_sigaction(SIGTERM, {SIG_DFL}, NULL, 8) = 0read(10, "#! /bin/sh\n#\n# (C) Copyright 199"..., 8192) = 8192write(2, "./xdosemu: 86: ", 15./xdosemu: 86: ) = 15write(2, "Syntax error: Bad substitution", 30Syntax error: Bad substitution) = 30
write(2, "\n", 1
) = 1exit_group(2) = ?
Process 4840 detached
Quoted 4 lines · Ralph Alvy
I'm getting the following error when running dosemu 1.2.2 under a newly installed Kubuntu 6.10:
./xdosemu: 86: Syntax error: Bad substitution
Just compiled 1.3.3 and have the same problem here.
Fri, Oct 27, 2006 at 08:32:32PM -0700, Ralph Alvy may have written:
Quoted 6 lines
I'm getting the following error when running dosemu 1.2.2 under a newly installed Kubuntu 6.10:
./xdosemu: 86: Syntax error: Bad substitution
What might be going on here?
That's an error message from your shell. It doesn't like something about line 86 of the "xdosemu" shell script. What does that line of that script look like (I don't have a dosemu I can look at right now)?
To get more information, you could turn on the shell's tracing mode; for Bourne shells, you can change:
#! /bin/sh
to
#! /bin/sh -x
or add a "set -x" command into the script.
Matt.
Signature · 3 lines
For a successful technology, reality must take precedence over public relations, for nature cannot be fooled. -- Richard P. Feynman
Quoted 18 lines · Matthew Clarke
Fri, Oct 27, 2006 at 08:32:32PM -0700, Ralph Alvy may have written:
Quoted 6 lines
I'm getting the following error when running dosemu 1.2.2 under a newly installed Kubuntu 6.10:
./xdosemu: 86: Syntax error: Bad substitution
What might be going on here?
That's an error message from your shell. It doesn't like something about line 86 of the "xdosemu" shell script. What does that line of that script look like (I don't have a dosemu I can look at right now)?
To get more information, you could turn on the shell's tracing mode; for Bourne shells, you can change:
#!
/bin/sh
Quoted 7 lines
to
#!
/bin/sh-xor add a "set -x" command into the script.
Matt.
84 -install)
85 INSTALL=1
86 if [ -n "$2" -a "${2:0:1}" != "-" ]; then
87 PROPRIETARY=$2
This is the only distro I've seen this happen, and I use dosemu 1.2.2 under Slackware 11, Arch Current, Debian Testing, Mepis 6, and Fedora Core 5.
Sat, Oct 28, 2006 at 05:14:55PM -0700, Ralph Alvy may have written:
Quoted 10 lines
Quoted 8 lines · Matthew Clarke
Fri, Oct 27, 2006 at 08:32:32PM -0700, Ralph Alvy may have written:
Quoted 6 lines
I'm getting the following error when running dosemu 1.2.2 under a newly installed Kubuntu 6.10:
./xdosemu: 86: Syntax error: Bad substitution
What might be going on here?
[ snip ]
Quoted 4 lines
84 -install)
85 INSTALL=1
86 if [ -n "$2" -a "${2:0:1}" != "-" ]; then
87 PROPRIETARY=$2
Line 1 of the script says "#! /bin/sh", which implies that the code in the script is written in the syntax understood by the Bourne shell. However, ${2:0:1} is syntax for the GNU Bourne-again shell (AKA bash), not the Bourne shell. My guess is that your other distributions make /bin/sh a symbolic link to /bin/bash, but that Kubuntu 6.10 points /bin/sh to some other shell that understands Bourne shell syntax but not bash syntax, so the other systems hide this error in the script but Kubuntu 6.10 doesn't.
If bash is installed as /bin/bash, you can change the first line of the script to
#! /bin/bash
to avoid the problem.
Matt.
Signature · 3 lines
For a successful technology, reality must take precedence over public relations, for nature cannot be fooled. -- Richard P. Feynman
Quoted 28 lines · Matthew Clarke
Sat, Oct 28, 2006 at 05:14:55PM -0700, Ralph Alvy may have written:
Quoted 10 lines
Quoted 8 lines · Matthew Clarke
Fri, Oct 27, 2006 at 08:32:32PM -0700, Ralph Alvy may have written:
Quoted 6 lines
I'm getting the following error when running dosemu 1.2.2 under a newly installed Kubuntu 6.10:
./xdosemu: 86: Syntax error: Bad substitution
What might be going on here?
[ snip ]
Quoted 4 lines
84 -install)
85 INSTALL=1
86 if [ -n "$2" -a "${2:0:1}" != "-" ]; then
87 PROPRIETARY=$2Line 1 of the script says "#!
/bin/sh", which implies that the code in the script is written in the syntax understood by the Bourne shell. However, ${2:0:1} is syntax for the GNU Bourne-again shell (AKA bash), not the Bourne shell. My guess is that your other distributions make/bin/sha symbolic link to/bin/bash, but that Kubuntu 6.10 points/bin/shto some other shell that understands Bourne shell syntax but not bash syntax, so the other systems hide this error in the script but Kubuntu 6.10 doesn't.
Quoted 8 lines
If bash is installed as
/bin/bash, you can change the first line of the script to#!
/bin/bashto avoid the problem.
Matt.
Thanks, Matt. This solved it nicely.
Quoted 7 lines · Matthew Clarke
Sat, Oct 28, 2006 at 05:14:55PM -0700, Ralph Alvy may have written:
Quoted 4 lines
84 -install)
85 INSTALL=1
86 if [ -n "$2" -a "${2:0:1}" != "-" ]; then
87 PROPRIETARY=$2
Quoted 6 lines
If bash is installed as
/bin/bash, you can change the first line of the script to#! /bin/bashto avoid the problem.
You could also replace line 86 by:
if [ -n "$2" -a -n "${2%%-*}" ]; thenwhich is portable to Bourne sh AFAIK (and a better solution for dosemu itself -- some distributions don't like /bin/bash scripts).
Bart
Quoted 11 lines · Bart Oldeman
Quoted 10 lines · Matthew Clarke
Sat, Oct 28, 2006 at 05:14:55PM -0700, Ralph Alvy may have written:
Quoted 4 lines
84 -install)
85 INSTALL=1
86 if [ -n "$2" -a "${2:0:1}" != "-" ]; then
87 PROPRIETARY=$2If bash is installed as
/bin/bash, you can change the first line of the script to
Quoted 8 lines
Quoted 3 lines
#! /bin/bashto avoid the problem.
You could also replace line 86 by:
if [ -n "$2" -a -n "${2%%-*}" ]; thenwhich is portable to Bourne sh AFAIK (and a better solution for dosemu itself -- some distributions don't like
/bin/bashscripts).
Well, for me anyway, I think it's easier to remember to change the first line to
#! /bin/bash
whenever I see this problem arise, which is so rare to begin with (only one disribution so far, among so many installed).
Quoted 1 line · Bart Oldeman
if [ -n "$2" -a -n "${2%%-*}" ]; then
I tried your substitution under Kubuntu 6.10. Two comments:
1. There's one more instance where the substitution must be made: line 98.
2. xdosemu loads fine, though there is one error message upon loading:
[: 373: 0: unexpected operator
Quoted 11 lines · Ralph Alvy
Quoted 1 line · Bart Oldeman
if [ -n "$2" -a -n "${2%%-*}" ]; then
I tried your substitution under Kubuntu 6.10. Two comments:
1. There's one more instance where the substitution must be made: line 98.
2. xdosemu loads fine, though there is one error message upon loading:
[: 373: 0: unexpected operator
[...]
That is because the new Ubuntu release uses dash instead of bash for /bin/sh and hence all bash constructs are not supported.
Signature · 1 line
mitu
Quoted 10 lines · Cristi Mitrana
Quoted 9 lines · Ralph Alvy
Quoted 1 line · Bart Oldeman
if [ -n "$2" -a -n "${2%%-*}" ]; then
I tried your substitution under Kubuntu 6.10. Two comments:
1. There's one more instance where the substitution must be made: line 98.
Quoted 9 lines
Quoted 3 lines
2. xdosemu loads fine, though there is one error message upon loading:
[: 373: 0: unexpected operator[...]
That is because the new Ubuntu release uses dash instead of bash for
/bin/shand hence all bash constructs are not supported.
Isn't that a rather severe change?
Quoted 1 line · Ralph Alvy
Cristi Mitrana wrote:
[..]
Quoted 6 lines
Quoted 4 lines
That is because the new Ubuntu release uses dash instead of bash for
/bin/shand hence all bash constructs are not supported.Isn't that a rather severe change?
It is actually, since dash is just a minimal POSIX shell without all the features that bash has it.
Any script that uses bash constructs should have #!/bin/bash at the beginning instead of #!/bin/sh. It's more of an annoyance this days, at least on linux, because bash is always available in any distro and it is the default shell.
Signature · 1 line
mitu
Quoted 13 lines · Cristi Mitrana
Quoted 1 line · Ralph Alvy
Cristi Mitrana wrote:
[..]
Quoted 6 lines
Quoted 4 lines
That is because the new Ubuntu release uses dash instead of bash for
/bin/shand hence all bash constructs are not supported.Isn't that a rather severe change?
Quoted 6 lines
It is actually, since dash is just a minimal POSIX shell without all the features that bash has it.
Any script that uses bash constructs should have #!/bin/bash at the beginning instead of #!/bin/sh. It's more of an annoyance this days, at least on linux, because bash is always available in any distro and it is the default shell.
Umm, I believe that all current releases of Linux have
$ ls -l /bin/sh lrwxrwxrwx 1 root root 4 Oct 20 2004 /bin/sh -> bash
AND bash also behaves somewhat differently when invoked as sh.
IMO, use of bash-specific features in released scripts is a bad idea, anyway. It results in extra maintenance.
Mike
Signature · 5 lines
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!Quoted 6 lines · Ralph Alvy
I'm getting the following error when running dosemu 1.2.2 under a newly installed Kubuntu 6.10:
./xdosemu: 86: Syntax error: Bad substitution
What might be going on here?
I noticed this comment on a Web page about compiling kernels with Ubuntu 6.10 (http://www.howtoforge.com/kernel_compilation_ubuntu). Pretty much sums up the problems outlined in this thread:
--- quote follows ---
On Ubuntu 6.10, /bin/sh is a symlink to /bin/dash by default. /bin/dash seems to make problems when you compile software from the sources, at least I had that impression. That's why I make /bin/sh a symlink to /bin/bash instead.
If you are on Ubuntu 6.10, you should do this now:
rm -f /bin/sh
ln -s /bin/bash /bin/sh
Quoted 7 lines · Ralph Alvy
--- quote follows ---
If you are on Ubuntu 6.10, you should do this now:
rm -f
/bin/sh
ln -s/bin/bash/bin/sh
There are still advantages in using dash over bash, e.g. scripts are executed faster that way. As for the remaining dosemu warning you got, replacing
$UID
byid -ur
in the dosemu script should fix that.
Bart
Quoted 18 lines · Bart Oldeman
Quoted 7 lines · Ralph Alvy
--- quote follows ---
If you are on Ubuntu 6.10, you should do this now:
rm -f
/bin/sh
ln -s/bin/bash/bin/shThere are still advantages in using dash over bash, e.g. scripts are executed faster that way. As for the remaining dosemu warning you got, replacing
$UID
byid -ur
in the dosemu script should fix that.
Quoted 1 line
Bart
I ended up just replacing
#! /bin/sh
with
#! /bin/bash
Seemed like the easiest thing to do.