Skip to main content
Not Linux, just shell syntax
Source Link
Chris Davies
  • 128.2k
  • 16
  • 179
  • 324

what is the meaning Is Integer in linuxof this shell script function

Can some one tell me what is the meaning of each line with an example , I am not getting why regex is used and even [!0122...] Can some one tell me what is the meaning of each line with an example , I am not getting why regex is used and even [!0122...]

#!/bin/sh
is_integer ()
{
    case "${1#[+-]}" in
        (*[!0123456789]*) return 1 ;;
        ('')              return 1 ;;
        (*)               return 0 ;;
    esac
}

what is the meaning Is Integer in linux

Can some one tell me what is the meaning of each line with an example , I am not getting why regex is used and even [!0122...]

#!/bin/sh
is_integer ()
{
    case "${1#[+-]}" in
        (*[!0123456789]*) return 1 ;;
        ('')              return 1 ;;
        (*)               return 0 ;;
    esac
}

what is the meaning of this shell script function

Can some one tell me what is the meaning of each line with an example , I am not getting why regex is used and even [!0122...]

#!/bin/sh
is_integer ()
{
    case "${1#[+-]}" in
        (*[!0123456789]*) return 1 ;;
        ('')              return 1 ;;
        (*)               return 0 ;;
    esac
}
Source Link

what is the meaning Is Integer in linux

Can some one tell me what is the meaning of each line with an example , I am not getting why regex is used and even [!0122...]

#!/bin/sh
is_integer ()
{
    case "${1#[+-]}" in
        (*[!0123456789]*) return 1 ;;
        ('')              return 1 ;;
        (*)               return 0 ;;
    esac
}