Skip to main content
deleted 17 characters in body; edited tags
Source Link
Gilles 'SO- stop being evil'
  • 866.1k
  • 205
  • 1.8k
  • 2.3k

I'm writing a script which will have some arguments and so I am using getopts but i want to solve the problem with one argument.

I use a switch, for example -d, and I want the argument for -d will be the path to a directory, like ./work.

I want to test the user's input for a string or path, not a number. Is there any solution to solve this problem? I want to solve it with something like:

If (test)
  then echo it is string
else 
  echo it is not string       

thank you

I'm writing a script which will have some arguments and so I am using getopts but i want to solve the problem with one argument.

I use a switch, for example -d, and I want the argument for -d will be the path to a directory, like ./work.

I want to test the user's input for a string or path, not a number. Is there any solution to solve this problem? I want to solve it with something like:

If (test)
  then echo it is string
else 
  echo it is not string       

thank you

I'm writing a script which will have some arguments and so I am using getopts but i want to solve the problem with one argument.

I use a switch, for example -d, and I want the argument for -d will be the path to a directory, like ./work.

I want to test the user's input for a string or path, not a number. Is there any solution to solve this problem? I want to solve it with something like:

If (test)
  then echo it is string
else 
  echo it is not string       
Grammar
Source Link
jasonwryan
  • 74.9k
  • 35
  • 204
  • 230

I searched questions but i cant find what i am looking for.

i`mI'm writing a script which will have some arguments and so on and i use getopts.I am using getopts but i want to solve the problem with one argument. 

I haveuse a switch, for example -d-d, and iI want thatthe argument for -d-d will be the path to a directory for example, like ./work./work and i

I want to make solution to a problem when usertest the user's input something else for example user will input -d 6 and 6 is number nota string or path, not a number. Is there any solution how to solve this problem because i have not found nothing helpful yet.? I want to solve it with something like:

If (test)
  then echo it is string
else 
  echo it is not string       

thank you

I searched questions but i cant find what i am looking for.

i`m writing a script which will have some arguments and so on and i use getopts. but i want to solve problem with one argument. I have switch for example -d and i want that argument for -d will be path to directory for example ./work and i want to make solution to a problem when user input something else for example user will input -d 6 and 6 is number not string or path. Is there any solution how to solve this problem because i have not found nothing helpful yet. I want to solve it with something like

If (test)
  then echo it is string
else 
  echo it is not string       

thank you

I'm writing a script which will have some arguments and so I am using getopts but i want to solve the problem with one argument. 

I use a switch, for example -d, and I want the argument for -d will be the path to a directory, like ./work.

I want to test the user's input for a string or path, not a number. Is there any solution to solve this problem? I want to solve it with something like:

If (test)
  then echo it is string
else 
  echo it is not string       

thank you

Source Link
xpukm
  • 13
  • 9

Test variable if its string or not

I searched questions but i cant find what i am looking for.

i`m writing a script which will have some arguments and so on and i use getopts. but i want to solve problem with one argument. I have switch for example -d and i want that argument for -d will be path to directory for example ./work and i want to make solution to a problem when user input something else for example user will input -d 6 and 6 is number not string or path. Is there any solution how to solve this problem because i have not found nothing helpful yet. I want to solve it with something like

If (test)
  then echo it is string
else 
  echo it is not string       

thank you