If you can limit your status values 0-127, with 0 for success, then you can do return "$status" and remove all your special return cases.
Also, you shouldn't do if [ $? -eq 1 ] since any code besides zero can mean error. You should do if [ $? -ne 0 ] to check if it's not zero, to catch every possible error value.
You could also do the precisely equivalent statement of
for the exact same effect in something short and straightforward. Or even KEYBOARD || break
Last edited by Corona688; 05-29-2017 at 02:27 PM..
(Will be back off holidays tomorrow for quicker replies.)
I like your 'return' method and it is now already coded for inside the next upload.
I researched the range of user available RCs and ended up using return 10 .
I used the number '1' in the example as proof of concept, no other reason.
I also checked any other of my break situations and all are valid.
Trust me to use a potential _exploit_ that I thought was valid. I knew Python was very strict, even from Version 1.4.0, (I still currently use this in AMIGA OS), but after using my getout method in bash I thought it was a_feature_ -- my bad. It has taught me to research deeper before commiting...
Thanks for that.
I am surprised however in all the years 'bash' has been around no-one has picked this up until some weeks ago...
'ksh' is fine as is 'dash' so I will test any ideas I get with those first before modifying to bash...
EDIT:
Just noticed your return $status and I like, very much. It will take a while to re-arrange but this will be added as I use statuses from 0 up to 255...
Last edited by wisecracker; 05-29-2017 at 03:46 PM..
Reason: See above...
I researched the range of user available RCs and ended up using return 10 .
There's only two "predefined", as it were:
0: Success
127: Killed via interrupt. Highest possible return code.
Anything else can mean whatever error you want it to mean. Some specific programs might have a traditional meaning for certain codes, but since audioscope is not any of those specific traditional programs, it doesn't matter.
127: Killed via interrupt. Highest possible return code.
Anything else can mean whatever error you want it to mean. Some specific programs might have a traditional meaning for certain codes, but since audioscope is not any of those specific traditional programs, it doesn't matter.
By convention, there are five classes of exit codes:
The standards require the 0 exit status to mean successful termination for most standard utilities. And they require 126 and 127 as described above for the command, env, nice, nohup, time, and xargs utilities. A process killed by a signal will exit with the above mentioned exit status, but there is nothing that keeps a process from exiting with an exit code greater than 128 (up to 255) even if it was not terminated by a signal.
On UNIX systems, a process killed by a SIGTERM signal would exit with exit code 143 and a process killed by a SIGKILL signal would exit with exit code 137. On other systems, the standards do not specify the signal numbers assigned to the various signals defined by the standards.
As always, there are exceptions to these conventions. (For example, the false utility's successful exit code is an unspecified non-zero value; not 0.)
What I found from the mighty WWW was what you put, plus, an exit code of '1' was a general case reserved number too. I only needed one exit code so '10' was easy to remember.
'QUIT' and 'EXIT' are not the same in the AudioScope.sh code anymore.
'QUIT' requires Corona688's return 10 whereas 'EXIT' uses exit 0 .
They both do different things now...
(AudioScope.sh with my major __bash_feature__ error corrected, is now ready for upload.)
Trust me to find a possible exploit that I thought was a feature.
It still surprises me it has taken this long to become apparent however.
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)
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)
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)
# 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)
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)
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)
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
8. Post Here to Contact Site Administrators and Moderators
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)