How to iterate through an array of numbers in shell-script?












1














I am trying to iterate through an array created after some command execution.
The code used is:



#!/bin/bash
mailx -H|grep '^ [UN]'>ListOfMessages.txt
msgNumbers=`cut -c 4-5 ListOfMessages.txt`
echo $msgNumbers
for msg in "${msgNumbers[@]}";
do
echo $msg;
echo $msg|mailx;
done


The ListOfMessages.txt look like:



 U  5 Sender1    Thu Aug 23 14:28  179/10454 Incident
U 7 Sender2 Thu Aug 23 15:20 179/10456 Incident
U 8 Sender3 Thu Aug 23 15:41 192/10801 Incident
N 9 Sender4 Thu Aug 23 15:45 197/11011 Incident


The array is getting updated with the numbers 5 7 8 9 as required.
I keep getting "Bad Substitution" error(at the line where for loop starts).



Please advise me on the she-bang to be used.










share|improve this question
























  • It seems to be a follow-up on How can we store the output of a command as an array in Unix shell script?.
    – Stéphane Chazelas
    Aug 23 at 10:36
















1














I am trying to iterate through an array created after some command execution.
The code used is:



#!/bin/bash
mailx -H|grep '^ [UN]'>ListOfMessages.txt
msgNumbers=`cut -c 4-5 ListOfMessages.txt`
echo $msgNumbers
for msg in "${msgNumbers[@]}";
do
echo $msg;
echo $msg|mailx;
done


The ListOfMessages.txt look like:



 U  5 Sender1    Thu Aug 23 14:28  179/10454 Incident
U 7 Sender2 Thu Aug 23 15:20 179/10456 Incident
U 8 Sender3 Thu Aug 23 15:41 192/10801 Incident
N 9 Sender4 Thu Aug 23 15:45 197/11011 Incident


The array is getting updated with the numbers 5 7 8 9 as required.
I keep getting "Bad Substitution" error(at the line where for loop starts).



Please advise me on the she-bang to be used.










share|improve this question
























  • It seems to be a follow-up on How can we store the output of a command as an array in Unix shell script?.
    – Stéphane Chazelas
    Aug 23 at 10:36














1












1








1







I am trying to iterate through an array created after some command execution.
The code used is:



#!/bin/bash
mailx -H|grep '^ [UN]'>ListOfMessages.txt
msgNumbers=`cut -c 4-5 ListOfMessages.txt`
echo $msgNumbers
for msg in "${msgNumbers[@]}";
do
echo $msg;
echo $msg|mailx;
done


The ListOfMessages.txt look like:



 U  5 Sender1    Thu Aug 23 14:28  179/10454 Incident
U 7 Sender2 Thu Aug 23 15:20 179/10456 Incident
U 8 Sender3 Thu Aug 23 15:41 192/10801 Incident
N 9 Sender4 Thu Aug 23 15:45 197/11011 Incident


The array is getting updated with the numbers 5 7 8 9 as required.
I keep getting "Bad Substitution" error(at the line where for loop starts).



Please advise me on the she-bang to be used.










share|improve this question















I am trying to iterate through an array created after some command execution.
The code used is:



#!/bin/bash
mailx -H|grep '^ [UN]'>ListOfMessages.txt
msgNumbers=`cut -c 4-5 ListOfMessages.txt`
echo $msgNumbers
for msg in "${msgNumbers[@]}";
do
echo $msg;
echo $msg|mailx;
done


The ListOfMessages.txt look like:



 U  5 Sender1    Thu Aug 23 14:28  179/10454 Incident
U 7 Sender2 Thu Aug 23 15:20 179/10456 Incident
U 8 Sender3 Thu Aug 23 15:41 192/10801 Incident
N 9 Sender4 Thu Aug 23 15:45 197/11011 Incident


The array is getting updated with the numbers 5 7 8 9 as required.
I keep getting "Bad Substitution" error(at the line where for loop starts).



Please advise me on the she-bang to be used.







shell-script array






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 13 at 15:04









Rui F Ribeiro

38.8k1479128




38.8k1479128










asked Aug 23 at 7:13









Devjith

457




457












  • It seems to be a follow-up on How can we store the output of a command as an array in Unix shell script?.
    – Stéphane Chazelas
    Aug 23 at 10:36


















  • It seems to be a follow-up on How can we store the output of a command as an array in Unix shell script?.
    – Stéphane Chazelas
    Aug 23 at 10:36
















It seems to be a follow-up on How can we store the output of a command as an array in Unix shell script?.
– Stéphane Chazelas
Aug 23 at 10:36




It seems to be a follow-up on How can we store the output of a command as an array in Unix shell script?.
– Stéphane Chazelas
Aug 23 at 10:36










4 Answers
4






active

oldest

votes


















2














As far as I can see, you have no array in your code. The variable msgNumbers is a string that holds the output of your cut command.



To iterate over the output of cut, use



#!/bin/bash

mailx -H | grep '^ [UN]' | cut -c 4-5 |
while read msg; do
print 'msg = %ss' "$msg"
done


This sends the output of cut into the while loop immediately following it, through the pipe (|). The while loop will iterate with msg set to each individual line of output from cut.



The cut gets its data directly from the grep command, which removes the need for storing the data in an intermediate file or variable.



I removed the echo $msg|mailx; command because it did not make much sense to me (the mailx utility needs an address to send the data to).



The grep+cut could also be replaced by a single call to awk where we let awk do the work of both tools and output the second whitespace-delimited column when the regular expression matches:



#!/bin/bash

mailx -H | awk '/^ [UN]/ { print $2 }' |
while read msg; do
print 'msg = %ss' "$msg"
done


I'm not commenting further on the use of mailx as it is a non-standard utility which is implemented slightly differently across Unix systems (my version does not have a -H option, for example).





The #!-line looks ok to me, if you want the script to be executed by bash and if the bash executable is located at that path (which it commonly is on Linux systems, for example, but check with command -v bash on your system to be sure). The code I have posted above is compatible with /bin/sh, so bash isn't really needed to run it (it would run in any sh-like shell).



Just make sure that the script is executable and that you run it without specifying an explicit interpreter.






share|improve this answer























  • The OP's probably on Solaris (10 or older) as they get Bourne shell error messages.
    – Stéphane Chazelas
    Aug 23 at 9:02



















0














Don't double quote the msgNumbers reference, and, msgNumbers is not an array, so the indexing is pointless.






share|improve this answer





















  • okay...then can you advise me how to store the result of command: cut -c 4-5 ListOfMessages.txt so that I can use the values one by one in a loop?
    – Devjith
    Aug 23 at 7:19












  • The first half tells how to make the for loop work, and the second half hints on improvement. Had the requestor given the input sample from the beginning, a more detailed answer (or even full blown solution) could have benn provided.
    – RudiC
    Aug 23 at 9:54





















0














Use () to store the value as an array.



msgNumbers=(`cut -c 4-5 ListOfMessages.txt`)
echo "${msgNumbers[@]}"
for msg in "${msgNumbers[@]}";
do
echo $msg;
done





share|improve this answer





















  • Tried with your answer....But getting an error: Shell_script.sh: syntax error at line 4: `msgNumbers=' unexpected
    – Devjith
    Aug 23 at 7:41










  • @Devjith, again, you've tried to interpret the script with sh, not bash. Don't run the script as sh the-script. Do a chmod a+x the-script and then ./the-script
    – Stéphane Chazelas
    Aug 23 at 9:00



















0














The issue is solved.
The problem was that msgNumbers was not an indexed array. So I changed the for msg in "${msgNumbers[@]}";to for msg in ${msgNumbers};.Now its working. The rest of the code is same as in my question.






share|improve this answer





















  • It's still not an array, and now you rely on the shell doing word splitting of the string in your variable, and filename generation ("globbing") on the words generated by the word splitting. Your code would now break if the IFS variable is set to one or several digits.
    – Kusalananda
    Aug 23 at 9:00











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f464313%2fhow-to-iterate-through-an-array-of-numbers-in-shell-script%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























4 Answers
4






active

oldest

votes








4 Answers
4






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














As far as I can see, you have no array in your code. The variable msgNumbers is a string that holds the output of your cut command.



To iterate over the output of cut, use



#!/bin/bash

mailx -H | grep '^ [UN]' | cut -c 4-5 |
while read msg; do
print 'msg = %ss' "$msg"
done


This sends the output of cut into the while loop immediately following it, through the pipe (|). The while loop will iterate with msg set to each individual line of output from cut.



The cut gets its data directly from the grep command, which removes the need for storing the data in an intermediate file or variable.



I removed the echo $msg|mailx; command because it did not make much sense to me (the mailx utility needs an address to send the data to).



The grep+cut could also be replaced by a single call to awk where we let awk do the work of both tools and output the second whitespace-delimited column when the regular expression matches:



#!/bin/bash

mailx -H | awk '/^ [UN]/ { print $2 }' |
while read msg; do
print 'msg = %ss' "$msg"
done


I'm not commenting further on the use of mailx as it is a non-standard utility which is implemented slightly differently across Unix systems (my version does not have a -H option, for example).





The #!-line looks ok to me, if you want the script to be executed by bash and if the bash executable is located at that path (which it commonly is on Linux systems, for example, but check with command -v bash on your system to be sure). The code I have posted above is compatible with /bin/sh, so bash isn't really needed to run it (it would run in any sh-like shell).



Just make sure that the script is executable and that you run it without specifying an explicit interpreter.






share|improve this answer























  • The OP's probably on Solaris (10 or older) as they get Bourne shell error messages.
    – Stéphane Chazelas
    Aug 23 at 9:02
















2














As far as I can see, you have no array in your code. The variable msgNumbers is a string that holds the output of your cut command.



To iterate over the output of cut, use



#!/bin/bash

mailx -H | grep '^ [UN]' | cut -c 4-5 |
while read msg; do
print 'msg = %ss' "$msg"
done


This sends the output of cut into the while loop immediately following it, through the pipe (|). The while loop will iterate with msg set to each individual line of output from cut.



The cut gets its data directly from the grep command, which removes the need for storing the data in an intermediate file or variable.



I removed the echo $msg|mailx; command because it did not make much sense to me (the mailx utility needs an address to send the data to).



The grep+cut could also be replaced by a single call to awk where we let awk do the work of both tools and output the second whitespace-delimited column when the regular expression matches:



#!/bin/bash

mailx -H | awk '/^ [UN]/ { print $2 }' |
while read msg; do
print 'msg = %ss' "$msg"
done


I'm not commenting further on the use of mailx as it is a non-standard utility which is implemented slightly differently across Unix systems (my version does not have a -H option, for example).





The #!-line looks ok to me, if you want the script to be executed by bash and if the bash executable is located at that path (which it commonly is on Linux systems, for example, but check with command -v bash on your system to be sure). The code I have posted above is compatible with /bin/sh, so bash isn't really needed to run it (it would run in any sh-like shell).



Just make sure that the script is executable and that you run it without specifying an explicit interpreter.






share|improve this answer























  • The OP's probably on Solaris (10 or older) as they get Bourne shell error messages.
    – Stéphane Chazelas
    Aug 23 at 9:02














2












2








2






As far as I can see, you have no array in your code. The variable msgNumbers is a string that holds the output of your cut command.



To iterate over the output of cut, use



#!/bin/bash

mailx -H | grep '^ [UN]' | cut -c 4-5 |
while read msg; do
print 'msg = %ss' "$msg"
done


This sends the output of cut into the while loop immediately following it, through the pipe (|). The while loop will iterate with msg set to each individual line of output from cut.



The cut gets its data directly from the grep command, which removes the need for storing the data in an intermediate file or variable.



I removed the echo $msg|mailx; command because it did not make much sense to me (the mailx utility needs an address to send the data to).



The grep+cut could also be replaced by a single call to awk where we let awk do the work of both tools and output the second whitespace-delimited column when the regular expression matches:



#!/bin/bash

mailx -H | awk '/^ [UN]/ { print $2 }' |
while read msg; do
print 'msg = %ss' "$msg"
done


I'm not commenting further on the use of mailx as it is a non-standard utility which is implemented slightly differently across Unix systems (my version does not have a -H option, for example).





The #!-line looks ok to me, if you want the script to be executed by bash and if the bash executable is located at that path (which it commonly is on Linux systems, for example, but check with command -v bash on your system to be sure). The code I have posted above is compatible with /bin/sh, so bash isn't really needed to run it (it would run in any sh-like shell).



Just make sure that the script is executable and that you run it without specifying an explicit interpreter.






share|improve this answer














As far as I can see, you have no array in your code. The variable msgNumbers is a string that holds the output of your cut command.



To iterate over the output of cut, use



#!/bin/bash

mailx -H | grep '^ [UN]' | cut -c 4-5 |
while read msg; do
print 'msg = %ss' "$msg"
done


This sends the output of cut into the while loop immediately following it, through the pipe (|). The while loop will iterate with msg set to each individual line of output from cut.



The cut gets its data directly from the grep command, which removes the need for storing the data in an intermediate file or variable.



I removed the echo $msg|mailx; command because it did not make much sense to me (the mailx utility needs an address to send the data to).



The grep+cut could also be replaced by a single call to awk where we let awk do the work of both tools and output the second whitespace-delimited column when the regular expression matches:



#!/bin/bash

mailx -H | awk '/^ [UN]/ { print $2 }' |
while read msg; do
print 'msg = %ss' "$msg"
done


I'm not commenting further on the use of mailx as it is a non-standard utility which is implemented slightly differently across Unix systems (my version does not have a -H option, for example).





The #!-line looks ok to me, if you want the script to be executed by bash and if the bash executable is located at that path (which it commonly is on Linux systems, for example, but check with command -v bash on your system to be sure). The code I have posted above is compatible with /bin/sh, so bash isn't really needed to run it (it would run in any sh-like shell).



Just make sure that the script is executable and that you run it without specifying an explicit interpreter.







share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday

























answered Aug 23 at 7:20









Kusalananda

121k16228372




121k16228372












  • The OP's probably on Solaris (10 or older) as they get Bourne shell error messages.
    – Stéphane Chazelas
    Aug 23 at 9:02


















  • The OP's probably on Solaris (10 or older) as they get Bourne shell error messages.
    – Stéphane Chazelas
    Aug 23 at 9:02
















The OP's probably on Solaris (10 or older) as they get Bourne shell error messages.
– Stéphane Chazelas
Aug 23 at 9:02




The OP's probably on Solaris (10 or older) as they get Bourne shell error messages.
– Stéphane Chazelas
Aug 23 at 9:02













0














Don't double quote the msgNumbers reference, and, msgNumbers is not an array, so the indexing is pointless.






share|improve this answer





















  • okay...then can you advise me how to store the result of command: cut -c 4-5 ListOfMessages.txt so that I can use the values one by one in a loop?
    – Devjith
    Aug 23 at 7:19












  • The first half tells how to make the for loop work, and the second half hints on improvement. Had the requestor given the input sample from the beginning, a more detailed answer (or even full blown solution) could have benn provided.
    – RudiC
    Aug 23 at 9:54


















0














Don't double quote the msgNumbers reference, and, msgNumbers is not an array, so the indexing is pointless.






share|improve this answer





















  • okay...then can you advise me how to store the result of command: cut -c 4-5 ListOfMessages.txt so that I can use the values one by one in a loop?
    – Devjith
    Aug 23 at 7:19












  • The first half tells how to make the for loop work, and the second half hints on improvement. Had the requestor given the input sample from the beginning, a more detailed answer (or even full blown solution) could have benn provided.
    – RudiC
    Aug 23 at 9:54
















0












0








0






Don't double quote the msgNumbers reference, and, msgNumbers is not an array, so the indexing is pointless.






share|improve this answer












Don't double quote the msgNumbers reference, and, msgNumbers is not an array, so the indexing is pointless.







share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 23 at 7:17









RudiC

3,9641312




3,9641312












  • okay...then can you advise me how to store the result of command: cut -c 4-5 ListOfMessages.txt so that I can use the values one by one in a loop?
    – Devjith
    Aug 23 at 7:19












  • The first half tells how to make the for loop work, and the second half hints on improvement. Had the requestor given the input sample from the beginning, a more detailed answer (or even full blown solution) could have benn provided.
    – RudiC
    Aug 23 at 9:54




















  • okay...then can you advise me how to store the result of command: cut -c 4-5 ListOfMessages.txt so that I can use the values one by one in a loop?
    – Devjith
    Aug 23 at 7:19












  • The first half tells how to make the for loop work, and the second half hints on improvement. Had the requestor given the input sample from the beginning, a more detailed answer (or even full blown solution) could have benn provided.
    – RudiC
    Aug 23 at 9:54


















okay...then can you advise me how to store the result of command: cut -c 4-5 ListOfMessages.txt so that I can use the values one by one in a loop?
– Devjith
Aug 23 at 7:19






okay...then can you advise me how to store the result of command: cut -c 4-5 ListOfMessages.txt so that I can use the values one by one in a loop?
– Devjith
Aug 23 at 7:19














The first half tells how to make the for loop work, and the second half hints on improvement. Had the requestor given the input sample from the beginning, a more detailed answer (or even full blown solution) could have benn provided.
– RudiC
Aug 23 at 9:54






The first half tells how to make the for loop work, and the second half hints on improvement. Had the requestor given the input sample from the beginning, a more detailed answer (or even full blown solution) could have benn provided.
– RudiC
Aug 23 at 9:54













0














Use () to store the value as an array.



msgNumbers=(`cut -c 4-5 ListOfMessages.txt`)
echo "${msgNumbers[@]}"
for msg in "${msgNumbers[@]}";
do
echo $msg;
done





share|improve this answer





















  • Tried with your answer....But getting an error: Shell_script.sh: syntax error at line 4: `msgNumbers=' unexpected
    – Devjith
    Aug 23 at 7:41










  • @Devjith, again, you've tried to interpret the script with sh, not bash. Don't run the script as sh the-script. Do a chmod a+x the-script and then ./the-script
    – Stéphane Chazelas
    Aug 23 at 9:00
















0














Use () to store the value as an array.



msgNumbers=(`cut -c 4-5 ListOfMessages.txt`)
echo "${msgNumbers[@]}"
for msg in "${msgNumbers[@]}";
do
echo $msg;
done





share|improve this answer





















  • Tried with your answer....But getting an error: Shell_script.sh: syntax error at line 4: `msgNumbers=' unexpected
    – Devjith
    Aug 23 at 7:41










  • @Devjith, again, you've tried to interpret the script with sh, not bash. Don't run the script as sh the-script. Do a chmod a+x the-script and then ./the-script
    – Stéphane Chazelas
    Aug 23 at 9:00














0












0








0






Use () to store the value as an array.



msgNumbers=(`cut -c 4-5 ListOfMessages.txt`)
echo "${msgNumbers[@]}"
for msg in "${msgNumbers[@]}";
do
echo $msg;
done





share|improve this answer












Use () to store the value as an array.



msgNumbers=(`cut -c 4-5 ListOfMessages.txt`)
echo "${msgNumbers[@]}"
for msg in "${msgNumbers[@]}";
do
echo $msg;
done






share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 23 at 7:22









msp9011

3,65543863




3,65543863












  • Tried with your answer....But getting an error: Shell_script.sh: syntax error at line 4: `msgNumbers=' unexpected
    – Devjith
    Aug 23 at 7:41










  • @Devjith, again, you've tried to interpret the script with sh, not bash. Don't run the script as sh the-script. Do a chmod a+x the-script and then ./the-script
    – Stéphane Chazelas
    Aug 23 at 9:00


















  • Tried with your answer....But getting an error: Shell_script.sh: syntax error at line 4: `msgNumbers=' unexpected
    – Devjith
    Aug 23 at 7:41










  • @Devjith, again, you've tried to interpret the script with sh, not bash. Don't run the script as sh the-script. Do a chmod a+x the-script and then ./the-script
    – Stéphane Chazelas
    Aug 23 at 9:00
















Tried with your answer....But getting an error: Shell_script.sh: syntax error at line 4: `msgNumbers=' unexpected
– Devjith
Aug 23 at 7:41




Tried with your answer....But getting an error: Shell_script.sh: syntax error at line 4: `msgNumbers=' unexpected
– Devjith
Aug 23 at 7:41












@Devjith, again, you've tried to interpret the script with sh, not bash. Don't run the script as sh the-script. Do a chmod a+x the-script and then ./the-script
– Stéphane Chazelas
Aug 23 at 9:00




@Devjith, again, you've tried to interpret the script with sh, not bash. Don't run the script as sh the-script. Do a chmod a+x the-script and then ./the-script
– Stéphane Chazelas
Aug 23 at 9:00











0














The issue is solved.
The problem was that msgNumbers was not an indexed array. So I changed the for msg in "${msgNumbers[@]}";to for msg in ${msgNumbers};.Now its working. The rest of the code is same as in my question.






share|improve this answer





















  • It's still not an array, and now you rely on the shell doing word splitting of the string in your variable, and filename generation ("globbing") on the words generated by the word splitting. Your code would now break if the IFS variable is set to one or several digits.
    – Kusalananda
    Aug 23 at 9:00
















0














The issue is solved.
The problem was that msgNumbers was not an indexed array. So I changed the for msg in "${msgNumbers[@]}";to for msg in ${msgNumbers};.Now its working. The rest of the code is same as in my question.






share|improve this answer





















  • It's still not an array, and now you rely on the shell doing word splitting of the string in your variable, and filename generation ("globbing") on the words generated by the word splitting. Your code would now break if the IFS variable is set to one or several digits.
    – Kusalananda
    Aug 23 at 9:00














0












0








0






The issue is solved.
The problem was that msgNumbers was not an indexed array. So I changed the for msg in "${msgNumbers[@]}";to for msg in ${msgNumbers};.Now its working. The rest of the code is same as in my question.






share|improve this answer












The issue is solved.
The problem was that msgNumbers was not an indexed array. So I changed the for msg in "${msgNumbers[@]}";to for msg in ${msgNumbers};.Now its working. The rest of the code is same as in my question.







share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 23 at 8:56









Devjith

457




457












  • It's still not an array, and now you rely on the shell doing word splitting of the string in your variable, and filename generation ("globbing") on the words generated by the word splitting. Your code would now break if the IFS variable is set to one or several digits.
    – Kusalananda
    Aug 23 at 9:00


















  • It's still not an array, and now you rely on the shell doing word splitting of the string in your variable, and filename generation ("globbing") on the words generated by the word splitting. Your code would now break if the IFS variable is set to one or several digits.
    – Kusalananda
    Aug 23 at 9:00
















It's still not an array, and now you rely on the shell doing word splitting of the string in your variable, and filename generation ("globbing") on the words generated by the word splitting. Your code would now break if the IFS variable is set to one or several digits.
– Kusalananda
Aug 23 at 9:00




It's still not an array, and now you rely on the shell doing word splitting of the string in your variable, and filename generation ("globbing") on the words generated by the word splitting. Your code would now break if the IFS variable is set to one or several digits.
– Kusalananda
Aug 23 at 9:00


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f464313%2fhow-to-iterate-through-an-array-of-numbers-in-shell-script%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

サソリ

広島県道265号伴広島線

Setup Asymptote in Texstudio