Sum of command line arguments?











up vote
0
down vote

favorite












How would I create a bash script that the user can use to sum any amount of command line arguments, but it will also ignore incompatible arguments? For example, say my script is called sum:



sum 10 -argument1 -argument2 -argument3 20


30



sum 7 -argument1 2 -argument2 1 -argument3


10










share|improve this question









New contributor




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
















  • 2




    What qualifies as an incompatible argument? What about -12, 1.2, 1,200,000, 1e2, 0x2, 0x4p5, nan, infinity, 2#1100, 0b1001, VII? Which of those qualify? Is 010 to be treated as octal or decimal? Should the locale be honoured when parsing radix and thousand separators?
    – Stéphane Chazelas
    Nov 22 at 13:08












  • (010), or binary @StéphaneChazelas :)
    – Romeo Ninov
    Nov 22 at 13:09










  • integers should qualify as compatible arguments
    – Calin Chaly
    Nov 22 at 13:15










  • Very similar to bash script for work
    – Kusalananda
    Nov 22 at 13:15






  • 2




    0xff, 010, 0b101, 1,200,000, -12, +12, 1.1e2, 0x4p5, 2#1100, VII are all some representation of some integer, should they be considered?
    – Stéphane Chazelas
    Nov 22 at 13:18

















up vote
0
down vote

favorite












How would I create a bash script that the user can use to sum any amount of command line arguments, but it will also ignore incompatible arguments? For example, say my script is called sum:



sum 10 -argument1 -argument2 -argument3 20


30



sum 7 -argument1 2 -argument2 1 -argument3


10










share|improve this question









New contributor




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
















  • 2




    What qualifies as an incompatible argument? What about -12, 1.2, 1,200,000, 1e2, 0x2, 0x4p5, nan, infinity, 2#1100, 0b1001, VII? Which of those qualify? Is 010 to be treated as octal or decimal? Should the locale be honoured when parsing radix and thousand separators?
    – Stéphane Chazelas
    Nov 22 at 13:08












  • (010), or binary @StéphaneChazelas :)
    – Romeo Ninov
    Nov 22 at 13:09










  • integers should qualify as compatible arguments
    – Calin Chaly
    Nov 22 at 13:15










  • Very similar to bash script for work
    – Kusalananda
    Nov 22 at 13:15






  • 2




    0xff, 010, 0b101, 1,200,000, -12, +12, 1.1e2, 0x4p5, 2#1100, VII are all some representation of some integer, should they be considered?
    – Stéphane Chazelas
    Nov 22 at 13:18















up vote
0
down vote

favorite









up vote
0
down vote

favorite











How would I create a bash script that the user can use to sum any amount of command line arguments, but it will also ignore incompatible arguments? For example, say my script is called sum:



sum 10 -argument1 -argument2 -argument3 20


30



sum 7 -argument1 2 -argument2 1 -argument3


10










share|improve this question









New contributor




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











How would I create a bash script that the user can use to sum any amount of command line arguments, but it will also ignore incompatible arguments? For example, say my script is called sum:



sum 10 -argument1 -argument2 -argument3 20


30



sum 7 -argument1 2 -argument2 1 -argument3


10







shell scripting arithmetic numeric-data






share|improve this question









New contributor




Calin Chaly 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




Calin Chaly 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








edited Nov 22 at 14:08









Jeff Schaller

36.8k1052121




36.8k1052121






New contributor




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









asked Nov 22 at 13:04









Calin Chaly

61




61




New contributor




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





New contributor





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






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








  • 2




    What qualifies as an incompatible argument? What about -12, 1.2, 1,200,000, 1e2, 0x2, 0x4p5, nan, infinity, 2#1100, 0b1001, VII? Which of those qualify? Is 010 to be treated as octal or decimal? Should the locale be honoured when parsing radix and thousand separators?
    – Stéphane Chazelas
    Nov 22 at 13:08












  • (010), or binary @StéphaneChazelas :)
    – Romeo Ninov
    Nov 22 at 13:09










  • integers should qualify as compatible arguments
    – Calin Chaly
    Nov 22 at 13:15










  • Very similar to bash script for work
    – Kusalananda
    Nov 22 at 13:15






  • 2




    0xff, 010, 0b101, 1,200,000, -12, +12, 1.1e2, 0x4p5, 2#1100, VII are all some representation of some integer, should they be considered?
    – Stéphane Chazelas
    Nov 22 at 13:18
















  • 2




    What qualifies as an incompatible argument? What about -12, 1.2, 1,200,000, 1e2, 0x2, 0x4p5, nan, infinity, 2#1100, 0b1001, VII? Which of those qualify? Is 010 to be treated as octal or decimal? Should the locale be honoured when parsing radix and thousand separators?
    – Stéphane Chazelas
    Nov 22 at 13:08












  • (010), or binary @StéphaneChazelas :)
    – Romeo Ninov
    Nov 22 at 13:09










  • integers should qualify as compatible arguments
    – Calin Chaly
    Nov 22 at 13:15










  • Very similar to bash script for work
    – Kusalananda
    Nov 22 at 13:15






  • 2




    0xff, 010, 0b101, 1,200,000, -12, +12, 1.1e2, 0x4p5, 2#1100, VII are all some representation of some integer, should they be considered?
    – Stéphane Chazelas
    Nov 22 at 13:18










2




2




What qualifies as an incompatible argument? What about -12, 1.2, 1,200,000, 1e2, 0x2, 0x4p5, nan, infinity, 2#1100, 0b1001, VII? Which of those qualify? Is 010 to be treated as octal or decimal? Should the locale be honoured when parsing radix and thousand separators?
– Stéphane Chazelas
Nov 22 at 13:08






What qualifies as an incompatible argument? What about -12, 1.2, 1,200,000, 1e2, 0x2, 0x4p5, nan, infinity, 2#1100, 0b1001, VII? Which of those qualify? Is 010 to be treated as octal or decimal? Should the locale be honoured when parsing radix and thousand separators?
– Stéphane Chazelas
Nov 22 at 13:08














(010), or binary @StéphaneChazelas :)
– Romeo Ninov
Nov 22 at 13:09




(010), or binary @StéphaneChazelas :)
– Romeo Ninov
Nov 22 at 13:09












integers should qualify as compatible arguments
– Calin Chaly
Nov 22 at 13:15




integers should qualify as compatible arguments
– Calin Chaly
Nov 22 at 13:15












Very similar to bash script for work
– Kusalananda
Nov 22 at 13:15




Very similar to bash script for work
– Kusalananda
Nov 22 at 13:15




2




2




0xff, 010, 0b101, 1,200,000, -12, +12, 1.1e2, 0x4p5, 2#1100, VII are all some representation of some integer, should they be considered?
– Stéphane Chazelas
Nov 22 at 13:18






0xff, 010, 0b101, 1,200,000, -12, +12, 1.1e2, 0x4p5, 2#1100, VII are all some representation of some integer, should they be considered?
– Stéphane Chazelas
Nov 22 at 13:18












3 Answers
3






active

oldest

votes

















up vote
1
down vote













With awk, assuming the sum and each individual number argument can fit in your system's long type, and only considering sequences of decimal digits with an optional leading - sign:



#! /bin/sh -
awk 'BEGIN{
sum = 0
for (i = 1; i < ARGC; i++)
if (ARGV[i] ~ /^-?[0123456789]+$/)
sum += ARGV[i]
print sum}' "$@"


For arbitrary precision, you can use bc:



#! /bin/sh -
awk 'BEGIN{
for (i = 1; i < ARGC; i++)
if (ARGV[i] ~ /^-?[0123456789]+$/)
print "s+="ARGV[i]
print "s"}' "$@" | bc


Example:



$ ./sum1 999999999999999999999999 1
999999999999999983222784
$ ./sum2 999999999999999999999999 1
1000000000000000000000000





share|improve this answer






























    up vote
    0
    down vote













    One (nonoptimal) example to do the sum:



    echo "$@" |awk '{for (i = 1; i <= NF; i++) j+=$i} END {print j}'


    (assuming number is everything awk accept as such)



    Example:



    ./ff 1 2 3.1   0x10 0100
    86.1


    And warning: any word which start with number will be interpreted as number






    share|improve this answer























    • For awk, in that context, 1WHATEVER2 would be understood as 1.
      – Stéphane Chazelas
      Nov 22 at 13:20










    • @StéphaneChazelasm true, but this accept integer, float, with exponent, hex, octal.....
      – Romeo Ninov
      Nov 22 at 13:22










    • Unquoted $@ might as well be $*
      – roaima
      Nov 22 at 14:11












    • ... and so you should use "$@" so the parameter "*" does not expand to a list of files.
      – glenn jackman
      Nov 22 at 14:18












    • Answer edited :)
      – Romeo Ninov
      Nov 22 at 14:19


















    up vote
    0
    down vote













    Here's another possibility



    printf "%sn" "$@" | awk '$1 ~ /^[[:digit:]]+$/ {s+=$1} END {print s}'


    It takes each argument from the command line and prints it, one per line. The awk script accepts this data and adds up non-zero positive values, printing the result when it's received all the data



    Example



    #!/bin/sh
    printf "%sn" "$@" | awk '$1 ~ /^[[:digit:]]+$/ {s+=$1} END {print s}'

    ./sum 1 -argument2 2 -argument4 3
    6


    If you could guarantee that your numeric arguments contained only digits you could simplify the check expression from $1 ~ /^[[:digit:]]+$/ to $1+0 > 0.






    share|improve this answer























    • That fails to exclude arguments like $'foon1234'.
      – Stéphane Chazelas
      Nov 22 at 17:40










    • @StéphaneChazelas indeed. Let's get a handle on what constitutes a number, first?
      – roaima
      Nov 22 at 18:04











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


    }
    });






    Calin Chaly 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%2f483446%2fsum-of-command-line-arguments%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    With awk, assuming the sum and each individual number argument can fit in your system's long type, and only considering sequences of decimal digits with an optional leading - sign:



    #! /bin/sh -
    awk 'BEGIN{
    sum = 0
    for (i = 1; i < ARGC; i++)
    if (ARGV[i] ~ /^-?[0123456789]+$/)
    sum += ARGV[i]
    print sum}' "$@"


    For arbitrary precision, you can use bc:



    #! /bin/sh -
    awk 'BEGIN{
    for (i = 1; i < ARGC; i++)
    if (ARGV[i] ~ /^-?[0123456789]+$/)
    print "s+="ARGV[i]
    print "s"}' "$@" | bc


    Example:



    $ ./sum1 999999999999999999999999 1
    999999999999999983222784
    $ ./sum2 999999999999999999999999 1
    1000000000000000000000000





    share|improve this answer



























      up vote
      1
      down vote













      With awk, assuming the sum and each individual number argument can fit in your system's long type, and only considering sequences of decimal digits with an optional leading - sign:



      #! /bin/sh -
      awk 'BEGIN{
      sum = 0
      for (i = 1; i < ARGC; i++)
      if (ARGV[i] ~ /^-?[0123456789]+$/)
      sum += ARGV[i]
      print sum}' "$@"


      For arbitrary precision, you can use bc:



      #! /bin/sh -
      awk 'BEGIN{
      for (i = 1; i < ARGC; i++)
      if (ARGV[i] ~ /^-?[0123456789]+$/)
      print "s+="ARGV[i]
      print "s"}' "$@" | bc


      Example:



      $ ./sum1 999999999999999999999999 1
      999999999999999983222784
      $ ./sum2 999999999999999999999999 1
      1000000000000000000000000





      share|improve this answer

























        up vote
        1
        down vote










        up vote
        1
        down vote









        With awk, assuming the sum and each individual number argument can fit in your system's long type, and only considering sequences of decimal digits with an optional leading - sign:



        #! /bin/sh -
        awk 'BEGIN{
        sum = 0
        for (i = 1; i < ARGC; i++)
        if (ARGV[i] ~ /^-?[0123456789]+$/)
        sum += ARGV[i]
        print sum}' "$@"


        For arbitrary precision, you can use bc:



        #! /bin/sh -
        awk 'BEGIN{
        for (i = 1; i < ARGC; i++)
        if (ARGV[i] ~ /^-?[0123456789]+$/)
        print "s+="ARGV[i]
        print "s"}' "$@" | bc


        Example:



        $ ./sum1 999999999999999999999999 1
        999999999999999983222784
        $ ./sum2 999999999999999999999999 1
        1000000000000000000000000





        share|improve this answer














        With awk, assuming the sum and each individual number argument can fit in your system's long type, and only considering sequences of decimal digits with an optional leading - sign:



        #! /bin/sh -
        awk 'BEGIN{
        sum = 0
        for (i = 1; i < ARGC; i++)
        if (ARGV[i] ~ /^-?[0123456789]+$/)
        sum += ARGV[i]
        print sum}' "$@"


        For arbitrary precision, you can use bc:



        #! /bin/sh -
        awk 'BEGIN{
        for (i = 1; i < ARGC; i++)
        if (ARGV[i] ~ /^-?[0123456789]+$/)
        print "s+="ARGV[i]
        print "s"}' "$@" | bc


        Example:



        $ ./sum1 999999999999999999999999 1
        999999999999999983222784
        $ ./sum2 999999999999999999999999 1
        1000000000000000000000000






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 22 at 18:43

























        answered Nov 22 at 13:16









        Stéphane Chazelas

        295k54556898




        295k54556898
























            up vote
            0
            down vote













            One (nonoptimal) example to do the sum:



            echo "$@" |awk '{for (i = 1; i <= NF; i++) j+=$i} END {print j}'


            (assuming number is everything awk accept as such)



            Example:



            ./ff 1 2 3.1   0x10 0100
            86.1


            And warning: any word which start with number will be interpreted as number






            share|improve this answer























            • For awk, in that context, 1WHATEVER2 would be understood as 1.
              – Stéphane Chazelas
              Nov 22 at 13:20










            • @StéphaneChazelasm true, but this accept integer, float, with exponent, hex, octal.....
              – Romeo Ninov
              Nov 22 at 13:22










            • Unquoted $@ might as well be $*
              – roaima
              Nov 22 at 14:11












            • ... and so you should use "$@" so the parameter "*" does not expand to a list of files.
              – glenn jackman
              Nov 22 at 14:18












            • Answer edited :)
              – Romeo Ninov
              Nov 22 at 14:19















            up vote
            0
            down vote













            One (nonoptimal) example to do the sum:



            echo "$@" |awk '{for (i = 1; i <= NF; i++) j+=$i} END {print j}'


            (assuming number is everything awk accept as such)



            Example:



            ./ff 1 2 3.1   0x10 0100
            86.1


            And warning: any word which start with number will be interpreted as number






            share|improve this answer























            • For awk, in that context, 1WHATEVER2 would be understood as 1.
              – Stéphane Chazelas
              Nov 22 at 13:20










            • @StéphaneChazelasm true, but this accept integer, float, with exponent, hex, octal.....
              – Romeo Ninov
              Nov 22 at 13:22










            • Unquoted $@ might as well be $*
              – roaima
              Nov 22 at 14:11












            • ... and so you should use "$@" so the parameter "*" does not expand to a list of files.
              – glenn jackman
              Nov 22 at 14:18












            • Answer edited :)
              – Romeo Ninov
              Nov 22 at 14:19













            up vote
            0
            down vote










            up vote
            0
            down vote









            One (nonoptimal) example to do the sum:



            echo "$@" |awk '{for (i = 1; i <= NF; i++) j+=$i} END {print j}'


            (assuming number is everything awk accept as such)



            Example:



            ./ff 1 2 3.1   0x10 0100
            86.1


            And warning: any word which start with number will be interpreted as number






            share|improve this answer














            One (nonoptimal) example to do the sum:



            echo "$@" |awk '{for (i = 1; i <= NF; i++) j+=$i} END {print j}'


            (assuming number is everything awk accept as such)



            Example:



            ./ff 1 2 3.1   0x10 0100
            86.1


            And warning: any word which start with number will be interpreted as number







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 22 at 14:19

























            answered Nov 22 at 13:19









            Romeo Ninov

            4,98431627




            4,98431627












            • For awk, in that context, 1WHATEVER2 would be understood as 1.
              – Stéphane Chazelas
              Nov 22 at 13:20










            • @StéphaneChazelasm true, but this accept integer, float, with exponent, hex, octal.....
              – Romeo Ninov
              Nov 22 at 13:22










            • Unquoted $@ might as well be $*
              – roaima
              Nov 22 at 14:11












            • ... and so you should use "$@" so the parameter "*" does not expand to a list of files.
              – glenn jackman
              Nov 22 at 14:18












            • Answer edited :)
              – Romeo Ninov
              Nov 22 at 14:19


















            • For awk, in that context, 1WHATEVER2 would be understood as 1.
              – Stéphane Chazelas
              Nov 22 at 13:20










            • @StéphaneChazelasm true, but this accept integer, float, with exponent, hex, octal.....
              – Romeo Ninov
              Nov 22 at 13:22










            • Unquoted $@ might as well be $*
              – roaima
              Nov 22 at 14:11












            • ... and so you should use "$@" so the parameter "*" does not expand to a list of files.
              – glenn jackman
              Nov 22 at 14:18












            • Answer edited :)
              – Romeo Ninov
              Nov 22 at 14:19
















            For awk, in that context, 1WHATEVER2 would be understood as 1.
            – Stéphane Chazelas
            Nov 22 at 13:20




            For awk, in that context, 1WHATEVER2 would be understood as 1.
            – Stéphane Chazelas
            Nov 22 at 13:20












            @StéphaneChazelasm true, but this accept integer, float, with exponent, hex, octal.....
            – Romeo Ninov
            Nov 22 at 13:22




            @StéphaneChazelasm true, but this accept integer, float, with exponent, hex, octal.....
            – Romeo Ninov
            Nov 22 at 13:22












            Unquoted $@ might as well be $*
            – roaima
            Nov 22 at 14:11






            Unquoted $@ might as well be $*
            – roaima
            Nov 22 at 14:11














            ... and so you should use "$@" so the parameter "*" does not expand to a list of files.
            – glenn jackman
            Nov 22 at 14:18






            ... and so you should use "$@" so the parameter "*" does not expand to a list of files.
            – glenn jackman
            Nov 22 at 14:18














            Answer edited :)
            – Romeo Ninov
            Nov 22 at 14:19




            Answer edited :)
            – Romeo Ninov
            Nov 22 at 14:19










            up vote
            0
            down vote













            Here's another possibility



            printf "%sn" "$@" | awk '$1 ~ /^[[:digit:]]+$/ {s+=$1} END {print s}'


            It takes each argument from the command line and prints it, one per line. The awk script accepts this data and adds up non-zero positive values, printing the result when it's received all the data



            Example



            #!/bin/sh
            printf "%sn" "$@" | awk '$1 ~ /^[[:digit:]]+$/ {s+=$1} END {print s}'

            ./sum 1 -argument2 2 -argument4 3
            6


            If you could guarantee that your numeric arguments contained only digits you could simplify the check expression from $1 ~ /^[[:digit:]]+$/ to $1+0 > 0.






            share|improve this answer























            • That fails to exclude arguments like $'foon1234'.
              – Stéphane Chazelas
              Nov 22 at 17:40










            • @StéphaneChazelas indeed. Let's get a handle on what constitutes a number, first?
              – roaima
              Nov 22 at 18:04















            up vote
            0
            down vote













            Here's another possibility



            printf "%sn" "$@" | awk '$1 ~ /^[[:digit:]]+$/ {s+=$1} END {print s}'


            It takes each argument from the command line and prints it, one per line. The awk script accepts this data and adds up non-zero positive values, printing the result when it's received all the data



            Example



            #!/bin/sh
            printf "%sn" "$@" | awk '$1 ~ /^[[:digit:]]+$/ {s+=$1} END {print s}'

            ./sum 1 -argument2 2 -argument4 3
            6


            If you could guarantee that your numeric arguments contained only digits you could simplify the check expression from $1 ~ /^[[:digit:]]+$/ to $1+0 > 0.






            share|improve this answer























            • That fails to exclude arguments like $'foon1234'.
              – Stéphane Chazelas
              Nov 22 at 17:40










            • @StéphaneChazelas indeed. Let's get a handle on what constitutes a number, first?
              – roaima
              Nov 22 at 18:04













            up vote
            0
            down vote










            up vote
            0
            down vote









            Here's another possibility



            printf "%sn" "$@" | awk '$1 ~ /^[[:digit:]]+$/ {s+=$1} END {print s}'


            It takes each argument from the command line and prints it, one per line. The awk script accepts this data and adds up non-zero positive values, printing the result when it's received all the data



            Example



            #!/bin/sh
            printf "%sn" "$@" | awk '$1 ~ /^[[:digit:]]+$/ {s+=$1} END {print s}'

            ./sum 1 -argument2 2 -argument4 3
            6


            If you could guarantee that your numeric arguments contained only digits you could simplify the check expression from $1 ~ /^[[:digit:]]+$/ to $1+0 > 0.






            share|improve this answer














            Here's another possibility



            printf "%sn" "$@" | awk '$1 ~ /^[[:digit:]]+$/ {s+=$1} END {print s}'


            It takes each argument from the command line and prints it, one per line. The awk script accepts this data and adds up non-zero positive values, printing the result when it's received all the data



            Example



            #!/bin/sh
            printf "%sn" "$@" | awk '$1 ~ /^[[:digit:]]+$/ {s+=$1} END {print s}'

            ./sum 1 -argument2 2 -argument4 3
            6


            If you could guarantee that your numeric arguments contained only digits you could simplify the check expression from $1 ~ /^[[:digit:]]+$/ to $1+0 > 0.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 22 at 14:21

























            answered Nov 22 at 14:14









            roaima

            42.1k550115




            42.1k550115












            • That fails to exclude arguments like $'foon1234'.
              – Stéphane Chazelas
              Nov 22 at 17:40










            • @StéphaneChazelas indeed. Let's get a handle on what constitutes a number, first?
              – roaima
              Nov 22 at 18:04


















            • That fails to exclude arguments like $'foon1234'.
              – Stéphane Chazelas
              Nov 22 at 17:40










            • @StéphaneChazelas indeed. Let's get a handle on what constitutes a number, first?
              – roaima
              Nov 22 at 18:04
















            That fails to exclude arguments like $'foon1234'.
            – Stéphane Chazelas
            Nov 22 at 17:40




            That fails to exclude arguments like $'foon1234'.
            – Stéphane Chazelas
            Nov 22 at 17:40












            @StéphaneChazelas indeed. Let's get a handle on what constitutes a number, first?
            – roaima
            Nov 22 at 18:04




            @StéphaneChazelas indeed. Let's get a handle on what constitutes a number, first?
            – roaima
            Nov 22 at 18:04










            Calin Chaly is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            Calin Chaly is a new contributor. Be nice, and check out our Code of Conduct.













            Calin Chaly is a new contributor. Be nice, and check out our Code of Conduct.












            Calin Chaly 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%2f483446%2fsum-of-command-line-arguments%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

            Morgemoulin

            Scott Moir

            Souastre