Sponsored Content
Top Forums UNIX for Advanced & Expert Users Has AudioScope found a bug in bash 4.4.5? Post 302998200 by wisecracker on Saturday 27th of May 2017 05:35:57 AM
Old 05-27-2017
Hi Corona688.

Still on a break with limited internet access but my 'ways are now changed'... ;o)
Well using the return method suits me fine.

I had no idea that this bug was near decades old and I was _exploiting_ it.
Thanks for pointing me in the right direction.

Here is a slightly simplified version of yours using dash as the prime mover.
OSX 10.12.5, default bash terminal calling 'dash' from the script...
I still get my variables where I want them so I am a happy bunny...
Code:
Last login: Sat May 27 10:20:46 on ttys000
AMIGA:amiga~> cd Desktop/Code/Shell
AMIGA:amiga~/Desktop/Code/Shell> cat kb_loop2.sh
#!/usr/local/bin/dash
# This passes the ShellCheck test as /bin/sh.
TEXT="Thank you Corona688."
status=0
KEYBOARD()
{
	printf "Enter QUIT to quit:- "
	read -r kbinput
	if [ "$kbinput" = "QUIT" ]
	then
		TEXT="YOU ARE HERE!"
		status=255
		echo "Exiting the KEYBOARD() function..."
                return 1
	elif [ "$kbinput" = "TEST" ]
	then
		echo "Hello World!"
	fi
        return 0
}
# Main loop...
while true
do
	echo "This will loop and hold until keyboard input is quitted."
	KEYBOARD
	if [ $? -eq 1 ]
	then
		break
	fi
done
echo "Now outside the loop..."
echo "$TEXT"
echo "Status = $status..."
AMIGA:amiga~/Desktop/Code/Shell> 
AMIGA:amiga~/Desktop/Code/Shell> 
AMIGA:amiga~/Desktop/Code/Shell> ./kb_loop2.sh
This will loop and hold until keyboard input is quitted.
Enter QUIT to quit:- NOTHING
This will loop and hold until keyboard input is quitted.
Enter QUIT to quit:- TEST
Hello World!
This will loop and hold until keyboard input is quitted.
Enter QUIT to quit:- QUIT
Exiting the KEYBOARD() function...
Now outside the loop...
YOU ARE HERE!
Status = 255...
AMIGA:amiga~/Desktop/Code/Shell> _

Thank you.
This User Gave Thanks to wisecracker For This Post:
 

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
READDIR(3)								 1								READDIR(3)

readdir - Read entry from directory handle

SYNOPSIS
string readdir ([resource $dir_handle]) DESCRIPTION
Returns the name of the next entry in the directory. The entries are returned in the order in which they are stored by the filesystem. PARAMETERS
o $dir_handle - The directory handle resource previously opened with opendir(3). If the directory handle is not specified, the last link opened by opendir(3) is assumed. RETURN VALUES
Returns the entry name on success or FALSE on failure. Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. EXAMPLES
Example #1 List all entries in a directory Please note the fashion in which readdir(3)'s return value is checked in the examples below. We are explicitly testing whether the return value is identical to (equal to and of the same type as--see Comparison Operators for more information) FALSE since other- wise, any directory entry whose name evaluates to FALSE will stop the loop (e.g. a directory named "0"). <?php if ($handle = opendir('/path/to/files')) { echo "Directory handle: $handle "; echo "Entries: "; /* This is the correct way to loop over the directory. */ while (false !== ($entry = readdir($handle))) { echo "$entry "; } /* This is the WRONG way to loop over the directory. */ while ($entry = readdir($handle)) { echo "$entry "; } closedir($handle); } ?> Example #2 List all entries in the current directory and strip out . and .. <?php if ($handle = opendir('.')) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { echo "$entry "; } } closedir($handle); } ?> SEE ALSO
is_dir(3), glob(3), opendir(3), scandir(3). PHP Documentation Group READDIR(3)
All times are GMT -4. The time now is 07:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy