Sponsored Content
Top Forums UNIX for Advanced & Expert Users Has AudioScope found a bug in bash 4.4.5? Post 302998045 by wisecracker on Wednesday 24th of May 2017 12:27:23 PM
Old 05-24-2017
Has AudioScope found a bug in bash 4.4.5?

Using AudioScope.sh on Ubuntu 17.04 from a live DVD disc I came across an error.
Consider the code below it is a MUCH shortened version of the KEYBOARD input in AudioScope.
Code:
#!/bin/bash
bash --version
uname -a
status=0
KEYBOARD()
{
	read -r -p "Enter QUIT or EXIT to quit:- " kbinput
	if [ "$kbinput" == "QUIT" ] || [ "$kbinput" == "EXIT" ]
	then
		status=255
		break
	fi
	if [ "$kbinput" == "TEST" ]
	then
		echo "Hello World!"
	fi
}
while true
do
	echo "This will loop and hold until keyboard input is quitted."
	KEYBOARD
done
echo "you are here..."

When run in OSX 10.12.5 this is the expected result:-
Code:
Last login: Wed May 24 16:37:36 on ttys000
AMIGA:amiga~> cd Desktop/Code/Shell
AMIGA:amiga~/Desktop/Code/Shell> ./kb_loop.sh
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Copyright (C) 2007 Free Software Foundation, Inc.
Darwin Barrys-MBP 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
This will loop and hold until keyboard input is quitted.
Enter QUIT or EXIT to quit:- TEST
Hello World!
This will loop and hold until keyboard input is quitted.
Enter QUIT or EXIT to quit:- QUIT
you are here...
AMIGA:amiga~/Desktop/Code/Shell> _

When run in Linux Mint 18 I get the same expected result from a LIVE DVD:-
Code:
mint@mint ~ $ chmod 755 kb_loop.sh
mint@mint ~ $ ./kb_loop.sh
GNU bash, version 4.3.42(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Linux mint 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
This will loop and hold until keyboard input is quitted.
Enter QUIT or EXIT to quit:- TEST
Hello World!
This will loop and hold until keyboard input is quitted.
Enter QUIT or EXIT to quit:- QUIT
you are here...
mint@mint ~ $ _

HOWEVER running from a Ubuntu 17.04 current LIVE DVD This is what ensues:-
Code:
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@ubuntu:~$ chmod 755 kb_loop.sh
ubuntu@ubuntu:~$ ./kb_loop.sh
GNU bash, version 4.4.5(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Linux ubuntu 4.10.0-19-generic #21-Ubuntu SMP Thu Apr 6 17:04:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
This will loop and hold until keyboard input is quitted.
Enter QUIT or EXIT to quit:- TEST
Hello World!
This will loop and hold until keyboard input is quitted.
Enter QUIT or EXIT to quit:- QUIT
./kb_loop.sh: line 11: break: only meaningful in a `for', `while', or `until' loop
This will loop and hold until keyboard input is quitted.
Enter QUIT or EXIT to quit:- _

NOTE the error:-
./kb_loop.sh: line 11: break: only meaningful in a `for', `while', or `until' loop
And it keeps looping with the same error.

Is this a bug in bash 4.4.5, as bash 4.3.42 and presumably earlier is perfectly fine?!

At what point between 4.3.42 and 4.4.5 would this have broken I wonder?

Can anyone else confirm this error please...

TIA.

Barry.
 

8 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Have I found a bug?

When searching for new posts, I see that my voting in one of the polls counts as a 'new post'. However, while the '<blah> minutes ago' entry updates correctly, the 'by <username>' is the last user to actually post a comment in the poll instead. Result: Poll: vB Guest Book 39... (4 Replies)
Discussion started by: Smiling Dragon
4 Replies

2. Shell Programming and Scripting

bash-function with array acting bizarre, bug?

Hello, basically what this script is supposed to do is showing a list of hosts that is given a number, that you will be able to choose from a list. A check is made to verify that the chosen number is within the array and this is where things go bad and I don't know why, bizarre. I've spent... (5 Replies)
Discussion started by: gand
5 Replies

3. Shell Programming and Scripting

mv command not found bug

foreach x ( *.foo) echo "move file?" set move=$< if($move == y) then echo "enter new pathname:" set path=$< mv $x $path/$x endif end ok guys, im creating this script so i can move files with *.foo extensions and *.bar... (6 Replies)
Discussion started by: pantelis
6 Replies

4. Shell Programming and Scripting

bash:vi:command not found

I downloaded and installed "Cygwin yesterday onto my PC running Windows XP. When I tried to type "vi" in Cygwin's window, I got the following message bash: vi: Command not found What shud i do inorder to get into vi editor Thanks (10 Replies)
Discussion started by: bobby1015
10 Replies

5. UNIX for Dummies Questions & Answers

Im new to bash scriping and i found this expression on a bash script what does this mean.

# check host value regex='^(||1|2|25)(\.(||1|2|25)){3}$' if ')" != "" ]; then if ]; then echo host $host not found exit 4 fi elif ]; then echo $host is an invalid host address exit 5 fi espeacailly the top regex part? ---------- Post updated at 06:58 PM ---------- Previous update was... (1 Reply)
Discussion started by: kevin298
1 Replies

6. Shell Programming and Scripting

-bash-3.2$: not found

I am wondering if someone can help me out. I am new to oracle and given a task to install Oracle 11g on Solaris. I am running into some major problems since last week since I can't seem to get it to work. I can't start GUI, tried different blogs but no luck. Then, I decided to install it in a... (4 Replies)
Discussion started by: newborndba
4 Replies

7. What is on Your Mind?

AudioScope...

Boy oh boy, with only a MONO mic input to use AudioScope gets much more difficult when the ALTDC board is included. It needs, so far, two hits at the MIC input with a single hit at the HEADPHONE audio output. The first at the highest practical resolution for the AC component and the second... (0 Replies)
Discussion started by: wisecracker
0 Replies

8. OS X (Apple)

AudioScope Project.

AudioScope Project. (Apologies for any typos.) For the few following...... AudioScope.sh... Now at Version 0.60.00. Well this baby has come a long way since its inception in January 2013. It is now at Version 0.60.00. It is MUCH more Apple centric now with a new OSX Sierra minimum _silent_... (7 Replies)
Discussion started by: wisecracker
7 Replies
All times are GMT -4. The time now is 09:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy