korn shell - if a variable exists in an array stop processing without exiting Announcing the...

The code below, is it ill-formed NDR or is it well formed?

How do I use the new nonlinear finite element in Mathematica 12 for this equation?

Why is Nikon 1.4g better when Nikon 1.8g is sharper?

How often does castling occur in grandmaster games?

Take 2! Is this homebrew Lady of Pain warlock patron balanced?

An adverb for when you're not exaggerating

What is the appropriate index architecture when forced to implement IsDeleted (soft deletes)?

Using audio cues to encourage good posture

What is a fractional matching?

Maximum summed subsequences with non-adjacent items

How fail-safe is nr as stop bytes?

Significance of Cersei's obsession with elephants?

How do I find out the mythology and history of my Fortress?

How could we fake a moon landing now?

Did Krishna say in Bhagavad Gita "I am in every living being"

Effects on objects due to a brief relocation of massive amounts of mass

Question about debouncing - delay of state change

Why is my ESD wriststrap failing with nitrile gloves on?

Is there any word for a place full of confusion?

How would a mousetrap for use in space work?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

How does the math work when buying airline miles?

Time to Settle Down!

Putting class ranking in CV, but against dept guidelines



korn shell - if a variable exists in an array stop processing without exiting



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionHow to do a control loopHow to print arguments from a known element until an unknown element of an array with BashARRAY- Accept user input and output the corresponding choice from arrayBash - Passing an array to remote hosts via sshShell scripting help text file into arrayWhy does an element of an array constructed with `readarray` gain a fictitious `n` when it's enclosed in double quotes?Problems creating array with newline separatorIndex range of array doesn't allow you to iterate over a new line in bashHow to delete existing elements from an array and keep appending new elements afterwardsSlicing the output of grep in bash





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















How would one evaluate priority of items in an array such that you only process the highest priority item that exists? Let me try to explain, if I had an array



set -A array low medium none high 


this array is created running a command in which the array could contain any or all of the listed elements. What I want to do is evaluate on whatever the highest priority element it finds and stop looping through the array without exiting the script. In other words if low and high exist, only evaluate on high and do not keep looping through the array. If medium and low exist, only evaluate on medium and stop looping.



The only way I've found to do this so far is a horrible kludge of multiple loops entered in the order I am looking for the element. If the element is found, then I exit before it can get to the next loop but I need to not have an exit or return if that makes sense.



Here's a sample:



#!/bin/sh

set -A array low medium none high

high() {
printf "Highn"
}
medium() {
printf "Mediumn"
}
low() {
printf "Lown"
}
none() {
printf "Nonen"
}

for i in ${array[*]}; do if [ ${i} = "high" ]; then high; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "medium" ]; then medium; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "low" ]; then low; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "none" ]; then none; exit 0; fi done


With the above code, if you change the array and take out any of the elements it is almost forced to evaluate based on the hierarchy I evaluate on. If high, low, medium, none exist it'll print high and exit. If you take out high and medium it'll print low and exit.



I have another script reading this so if I exit, it exits the entire chain including the parent that loads this so I'm trying to figure out how I can stop evaluating any elements from the array once I've found the highest priority for lack of a better description.



If i take out the exists it just hits each loop and gives output for each loop. I've tried unsuccessfully with elif and else but it always evaluates every element.



Any ideas? Is it even possible to have it stop without exiting the script?










share|improve this question







New contributor




Lonny Selinger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1





    use break instead of exit.

    – mosvy
    5 hours ago











  • Also, use the correct path to ksh on your system in the #!-line. /bin/sh will generally not support arrays.

    – Kusalananda
    5 hours ago











  • true regarding path. The rub is that this is on AIX so default shell is korn. I'm just so used to it being korn regardless I seldom explicitly quilify ksh.

    – Lonny Selinger
    5 hours ago











  • @LonnySelinger Even if /bin/sh is Korn shell on your system, it would be Korn shell running in POSIX mode, which would quite likely be different from ksh.

    – Kusalananda
    5 hours ago


















1















How would one evaluate priority of items in an array such that you only process the highest priority item that exists? Let me try to explain, if I had an array



set -A array low medium none high 


this array is created running a command in which the array could contain any or all of the listed elements. What I want to do is evaluate on whatever the highest priority element it finds and stop looping through the array without exiting the script. In other words if low and high exist, only evaluate on high and do not keep looping through the array. If medium and low exist, only evaluate on medium and stop looping.



The only way I've found to do this so far is a horrible kludge of multiple loops entered in the order I am looking for the element. If the element is found, then I exit before it can get to the next loop but I need to not have an exit or return if that makes sense.



Here's a sample:



#!/bin/sh

set -A array low medium none high

high() {
printf "Highn"
}
medium() {
printf "Mediumn"
}
low() {
printf "Lown"
}
none() {
printf "Nonen"
}

for i in ${array[*]}; do if [ ${i} = "high" ]; then high; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "medium" ]; then medium; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "low" ]; then low; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "none" ]; then none; exit 0; fi done


With the above code, if you change the array and take out any of the elements it is almost forced to evaluate based on the hierarchy I evaluate on. If high, low, medium, none exist it'll print high and exit. If you take out high and medium it'll print low and exit.



I have another script reading this so if I exit, it exits the entire chain including the parent that loads this so I'm trying to figure out how I can stop evaluating any elements from the array once I've found the highest priority for lack of a better description.



If i take out the exists it just hits each loop and gives output for each loop. I've tried unsuccessfully with elif and else but it always evaluates every element.



Any ideas? Is it even possible to have it stop without exiting the script?










share|improve this question







New contributor




Lonny Selinger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1





    use break instead of exit.

    – mosvy
    5 hours ago











  • Also, use the correct path to ksh on your system in the #!-line. /bin/sh will generally not support arrays.

    – Kusalananda
    5 hours ago











  • true regarding path. The rub is that this is on AIX so default shell is korn. I'm just so used to it being korn regardless I seldom explicitly quilify ksh.

    – Lonny Selinger
    5 hours ago











  • @LonnySelinger Even if /bin/sh is Korn shell on your system, it would be Korn shell running in POSIX mode, which would quite likely be different from ksh.

    – Kusalananda
    5 hours ago














1












1








1








How would one evaluate priority of items in an array such that you only process the highest priority item that exists? Let me try to explain, if I had an array



set -A array low medium none high 


this array is created running a command in which the array could contain any or all of the listed elements. What I want to do is evaluate on whatever the highest priority element it finds and stop looping through the array without exiting the script. In other words if low and high exist, only evaluate on high and do not keep looping through the array. If medium and low exist, only evaluate on medium and stop looping.



The only way I've found to do this so far is a horrible kludge of multiple loops entered in the order I am looking for the element. If the element is found, then I exit before it can get to the next loop but I need to not have an exit or return if that makes sense.



Here's a sample:



#!/bin/sh

set -A array low medium none high

high() {
printf "Highn"
}
medium() {
printf "Mediumn"
}
low() {
printf "Lown"
}
none() {
printf "Nonen"
}

for i in ${array[*]}; do if [ ${i} = "high" ]; then high; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "medium" ]; then medium; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "low" ]; then low; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "none" ]; then none; exit 0; fi done


With the above code, if you change the array and take out any of the elements it is almost forced to evaluate based on the hierarchy I evaluate on. If high, low, medium, none exist it'll print high and exit. If you take out high and medium it'll print low and exit.



I have another script reading this so if I exit, it exits the entire chain including the parent that loads this so I'm trying to figure out how I can stop evaluating any elements from the array once I've found the highest priority for lack of a better description.



If i take out the exists it just hits each loop and gives output for each loop. I've tried unsuccessfully with elif and else but it always evaluates every element.



Any ideas? Is it even possible to have it stop without exiting the script?










share|improve this question







New contributor




Lonny Selinger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












How would one evaluate priority of items in an array such that you only process the highest priority item that exists? Let me try to explain, if I had an array



set -A array low medium none high 


this array is created running a command in which the array could contain any or all of the listed elements. What I want to do is evaluate on whatever the highest priority element it finds and stop looping through the array without exiting the script. In other words if low and high exist, only evaluate on high and do not keep looping through the array. If medium and low exist, only evaluate on medium and stop looping.



The only way I've found to do this so far is a horrible kludge of multiple loops entered in the order I am looking for the element. If the element is found, then I exit before it can get to the next loop but I need to not have an exit or return if that makes sense.



Here's a sample:



#!/bin/sh

set -A array low medium none high

high() {
printf "Highn"
}
medium() {
printf "Mediumn"
}
low() {
printf "Lown"
}
none() {
printf "Nonen"
}

for i in ${array[*]}; do if [ ${i} = "high" ]; then high; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "medium" ]; then medium; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "low" ]; then low; exit 0; fi done
for i in ${array[*]}; do if [ ${i} = "none" ]; then none; exit 0; fi done


With the above code, if you change the array and take out any of the elements it is almost forced to evaluate based on the hierarchy I evaluate on. If high, low, medium, none exist it'll print high and exit. If you take out high and medium it'll print low and exit.



I have another script reading this so if I exit, it exits the entire chain including the parent that loads this so I'm trying to figure out how I can stop evaluating any elements from the array once I've found the highest priority for lack of a better description.



If i take out the exists it just hits each loop and gives output for each loop. I've tried unsuccessfully with elif and else but it always evaluates every element.



Any ideas? Is it even possible to have it stop without exiting the script?







shell-script scripting array






share|improve this question







New contributor




Lonny Selinger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Lonny Selinger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Lonny Selinger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 5 hours ago









Lonny SelingerLonny Selinger

83




83




New contributor




Lonny Selinger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Lonny Selinger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Lonny Selinger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1





    use break instead of exit.

    – mosvy
    5 hours ago











  • Also, use the correct path to ksh on your system in the #!-line. /bin/sh will generally not support arrays.

    – Kusalananda
    5 hours ago











  • true regarding path. The rub is that this is on AIX so default shell is korn. I'm just so used to it being korn regardless I seldom explicitly quilify ksh.

    – Lonny Selinger
    5 hours ago











  • @LonnySelinger Even if /bin/sh is Korn shell on your system, it would be Korn shell running in POSIX mode, which would quite likely be different from ksh.

    – Kusalananda
    5 hours ago














  • 1





    use break instead of exit.

    – mosvy
    5 hours ago











  • Also, use the correct path to ksh on your system in the #!-line. /bin/sh will generally not support arrays.

    – Kusalananda
    5 hours ago











  • true regarding path. The rub is that this is on AIX so default shell is korn. I'm just so used to it being korn regardless I seldom explicitly quilify ksh.

    – Lonny Selinger
    5 hours ago











  • @LonnySelinger Even if /bin/sh is Korn shell on your system, it would be Korn shell running in POSIX mode, which would quite likely be different from ksh.

    – Kusalananda
    5 hours ago








1




1





use break instead of exit.

– mosvy
5 hours ago





use break instead of exit.

– mosvy
5 hours ago













Also, use the correct path to ksh on your system in the #!-line. /bin/sh will generally not support arrays.

– Kusalananda
5 hours ago





Also, use the correct path to ksh on your system in the #!-line. /bin/sh will generally not support arrays.

– Kusalananda
5 hours ago













true regarding path. The rub is that this is on AIX so default shell is korn. I'm just so used to it being korn regardless I seldom explicitly quilify ksh.

– Lonny Selinger
5 hours ago





true regarding path. The rub is that this is on AIX so default shell is korn. I'm just so used to it being korn regardless I seldom explicitly quilify ksh.

– Lonny Selinger
5 hours ago













@LonnySelinger Even if /bin/sh is Korn shell on your system, it would be Korn shell running in POSIX mode, which would quite likely be different from ksh.

– Kusalananda
5 hours ago





@LonnySelinger Even if /bin/sh is Korn shell on your system, it would be Korn shell running in POSIX mode, which would quite likely be different from ksh.

– Kusalananda
5 hours ago










1 Answer
1






active

oldest

votes


















0














#!/bin/ksh

high () echo High
medium () echo Medium
low () echo Low
none () echo None

set -A array low medium none high

for level in high medium low none; do
for elem in "${array[@]}"; do
if [ "$elem" = "$level" ]; then
"$level"
break 2
fi
done
done


This is a double loop. The outer loop loops over the levels in order of importance. The inner loop loops over the elements in the array, looking for an element that is equal to the current level.



If an element is found that corresponds to the current level, the function with the same name as the level is called and the two loops are exited.



Note that in the general case, you'd want to loop over "${array[@]}" rather than ${array[*]} as using [*] (and leaving the expansion unquoted) would do both word splitting and filename globbing on the strings in the array. The expression "${array[@]}" would expand to the individually quoted elements of the array array.



Avoiding word splitting and filename globbing is also the reason for quoting both $elem and $level when comparing them etc.





A possibly quicker way to do this would be to first create an associative array with the element from the array as keys and then just do key lookups in that:



#!/bin/ksh

high () echo High
medium () echo Medium
low () echo Low
none () echo None

array=( low medium none high )

typeset -A lookup

for elem in "${array[@]}"; do
lookup["$elem"]=1
done

for level in high medium low none; do
if [ -n "${lookup[$level]}" ]; then
"$level"
break
fi
done


This avoids the double loop, which would be useful if either the array or the number of level, or both, are very long.



I've also switched to the more common =(...) assignment form for arrays.






share|improve this answer


























  • Oy, I've been fighting with this for a day already. Thank you! worked like a charm!

    – Lonny Selinger
    5 hours ago











  • I forgot to mention I also added set -o noglob as i ran into that earlier. I can see uses for both now that I'm digging deeper into some of my other functions.

    – Lonny Selinger
    5 hours ago












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Lonny Selinger is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f513264%2fkorn-shell-if-a-variable-exists-in-an-array-stop-processing-without-exiting%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














#!/bin/ksh

high () echo High
medium () echo Medium
low () echo Low
none () echo None

set -A array low medium none high

for level in high medium low none; do
for elem in "${array[@]}"; do
if [ "$elem" = "$level" ]; then
"$level"
break 2
fi
done
done


This is a double loop. The outer loop loops over the levels in order of importance. The inner loop loops over the elements in the array, looking for an element that is equal to the current level.



If an element is found that corresponds to the current level, the function with the same name as the level is called and the two loops are exited.



Note that in the general case, you'd want to loop over "${array[@]}" rather than ${array[*]} as using [*] (and leaving the expansion unquoted) would do both word splitting and filename globbing on the strings in the array. The expression "${array[@]}" would expand to the individually quoted elements of the array array.



Avoiding word splitting and filename globbing is also the reason for quoting both $elem and $level when comparing them etc.





A possibly quicker way to do this would be to first create an associative array with the element from the array as keys and then just do key lookups in that:



#!/bin/ksh

high () echo High
medium () echo Medium
low () echo Low
none () echo None

array=( low medium none high )

typeset -A lookup

for elem in "${array[@]}"; do
lookup["$elem"]=1
done

for level in high medium low none; do
if [ -n "${lookup[$level]}" ]; then
"$level"
break
fi
done


This avoids the double loop, which would be useful if either the array or the number of level, or both, are very long.



I've also switched to the more common =(...) assignment form for arrays.






share|improve this answer


























  • Oy, I've been fighting with this for a day already. Thank you! worked like a charm!

    – Lonny Selinger
    5 hours ago











  • I forgot to mention I also added set -o noglob as i ran into that earlier. I can see uses for both now that I'm digging deeper into some of my other functions.

    – Lonny Selinger
    5 hours ago
















0














#!/bin/ksh

high () echo High
medium () echo Medium
low () echo Low
none () echo None

set -A array low medium none high

for level in high medium low none; do
for elem in "${array[@]}"; do
if [ "$elem" = "$level" ]; then
"$level"
break 2
fi
done
done


This is a double loop. The outer loop loops over the levels in order of importance. The inner loop loops over the elements in the array, looking for an element that is equal to the current level.



If an element is found that corresponds to the current level, the function with the same name as the level is called and the two loops are exited.



Note that in the general case, you'd want to loop over "${array[@]}" rather than ${array[*]} as using [*] (and leaving the expansion unquoted) would do both word splitting and filename globbing on the strings in the array. The expression "${array[@]}" would expand to the individually quoted elements of the array array.



Avoiding word splitting and filename globbing is also the reason for quoting both $elem and $level when comparing them etc.





A possibly quicker way to do this would be to first create an associative array with the element from the array as keys and then just do key lookups in that:



#!/bin/ksh

high () echo High
medium () echo Medium
low () echo Low
none () echo None

array=( low medium none high )

typeset -A lookup

for elem in "${array[@]}"; do
lookup["$elem"]=1
done

for level in high medium low none; do
if [ -n "${lookup[$level]}" ]; then
"$level"
break
fi
done


This avoids the double loop, which would be useful if either the array or the number of level, or both, are very long.



I've also switched to the more common =(...) assignment form for arrays.






share|improve this answer


























  • Oy, I've been fighting with this for a day already. Thank you! worked like a charm!

    – Lonny Selinger
    5 hours ago











  • I forgot to mention I also added set -o noglob as i ran into that earlier. I can see uses for both now that I'm digging deeper into some of my other functions.

    – Lonny Selinger
    5 hours ago














0












0








0







#!/bin/ksh

high () echo High
medium () echo Medium
low () echo Low
none () echo None

set -A array low medium none high

for level in high medium low none; do
for elem in "${array[@]}"; do
if [ "$elem" = "$level" ]; then
"$level"
break 2
fi
done
done


This is a double loop. The outer loop loops over the levels in order of importance. The inner loop loops over the elements in the array, looking for an element that is equal to the current level.



If an element is found that corresponds to the current level, the function with the same name as the level is called and the two loops are exited.



Note that in the general case, you'd want to loop over "${array[@]}" rather than ${array[*]} as using [*] (and leaving the expansion unquoted) would do both word splitting and filename globbing on the strings in the array. The expression "${array[@]}" would expand to the individually quoted elements of the array array.



Avoiding word splitting and filename globbing is also the reason for quoting both $elem and $level when comparing them etc.





A possibly quicker way to do this would be to first create an associative array with the element from the array as keys and then just do key lookups in that:



#!/bin/ksh

high () echo High
medium () echo Medium
low () echo Low
none () echo None

array=( low medium none high )

typeset -A lookup

for elem in "${array[@]}"; do
lookup["$elem"]=1
done

for level in high medium low none; do
if [ -n "${lookup[$level]}" ]; then
"$level"
break
fi
done


This avoids the double loop, which would be useful if either the array or the number of level, or both, are very long.



I've also switched to the more common =(...) assignment form for arrays.






share|improve this answer















#!/bin/ksh

high () echo High
medium () echo Medium
low () echo Low
none () echo None

set -A array low medium none high

for level in high medium low none; do
for elem in "${array[@]}"; do
if [ "$elem" = "$level" ]; then
"$level"
break 2
fi
done
done


This is a double loop. The outer loop loops over the levels in order of importance. The inner loop loops over the elements in the array, looking for an element that is equal to the current level.



If an element is found that corresponds to the current level, the function with the same name as the level is called and the two loops are exited.



Note that in the general case, you'd want to loop over "${array[@]}" rather than ${array[*]} as using [*] (and leaving the expansion unquoted) would do both word splitting and filename globbing on the strings in the array. The expression "${array[@]}" would expand to the individually quoted elements of the array array.



Avoiding word splitting and filename globbing is also the reason for quoting both $elem and $level when comparing them etc.





A possibly quicker way to do this would be to first create an associative array with the element from the array as keys and then just do key lookups in that:



#!/bin/ksh

high () echo High
medium () echo Medium
low () echo Low
none () echo None

array=( low medium none high )

typeset -A lookup

for elem in "${array[@]}"; do
lookup["$elem"]=1
done

for level in high medium low none; do
if [ -n "${lookup[$level]}" ]; then
"$level"
break
fi
done


This avoids the double loop, which would be useful if either the array or the number of level, or both, are very long.



I've also switched to the more common =(...) assignment form for arrays.







share|improve this answer














share|improve this answer



share|improve this answer








edited 5 hours ago

























answered 5 hours ago









KusalanandaKusalananda

142k18266442




142k18266442













  • Oy, I've been fighting with this for a day already. Thank you! worked like a charm!

    – Lonny Selinger
    5 hours ago











  • I forgot to mention I also added set -o noglob as i ran into that earlier. I can see uses for both now that I'm digging deeper into some of my other functions.

    – Lonny Selinger
    5 hours ago



















  • Oy, I've been fighting with this for a day already. Thank you! worked like a charm!

    – Lonny Selinger
    5 hours ago











  • I forgot to mention I also added set -o noglob as i ran into that earlier. I can see uses for both now that I'm digging deeper into some of my other functions.

    – Lonny Selinger
    5 hours ago

















Oy, I've been fighting with this for a day already. Thank you! worked like a charm!

– Lonny Selinger
5 hours ago





Oy, I've been fighting with this for a day already. Thank you! worked like a charm!

– Lonny Selinger
5 hours ago













I forgot to mention I also added set -o noglob as i ran into that earlier. I can see uses for both now that I'm digging deeper into some of my other functions.

– Lonny Selinger
5 hours ago





I forgot to mention I also added set -o noglob as i ran into that earlier. I can see uses for both now that I'm digging deeper into some of my other functions.

– Lonny Selinger
5 hours ago










Lonny Selinger is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Lonny Selinger is a new contributor. Be nice, and check out our Code of Conduct.













Lonny Selinger is a new contributor. Be nice, and check out our Code of Conduct.












Lonny Selinger is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f513264%2fkorn-shell-if-a-variable-exists-in-an-array-stop-processing-without-exiting%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...