0

How to check whether the given value from the command line is a string or not in bash scripting?

eg: I will give input as stackoverflow from the command line and my bash script should check the given value is a string(i mean a sequence of characters) or a numeric value.

3
  • And what is your criterion for something, being a string? Bash is an untyped language, so it's not so clear what is a string, and what is not. Commented Mar 14, 2018 at 0:58
  • Please, read how to ask useful questions. Commented Mar 14, 2018 at 1:26
  • 1
    All values in bash are sequences of characters (except when declare -i is in use, but it's poor form). Even 12 is a sequence of characters (first the character 1, then the character 2); and when you run newvar=$(( 12 + 1 )), the value of 13 resulting from that is a string as well. Commented Mar 14, 2018 at 1:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.