Welcome to my website. I am always posting links to photo albums, art, technology and other creations. Everything that you will see on my numerous personal sites is powered by the formVistaTM Website Management Engine.

icon.linkedin.jpgicon.twitter.jpg

  • Checking that Input or a Variable is an Integer in BASH
    08/26/2014 9:02AM

    Here is a quick snippet for checking whether or not a variable is a valid integer in BASH.  It is also a howto for regular expressions in a shell script.

    # Make sure that FOO is an integer
    if [[ ! "$FOO" =~ ^[0-9]+$ ]]; then
            echo "The FOO was NOT an integer"
    fi

Advanced Search

Categories

Archives