Thursday 15 August 2013

linux - verifing some arguments in bash -


I'm verifying one in BASH

  if [! ((-e $ f) || ($ # -lt2) || (-D $ F));; Again exit 0f   

I am trying to see if the file exists or if it is a directory or if enough arguments pass through the terminal I can do this Or should it be done in any other way?

Reject anything that is not a simple file, in that case, instead of the -e If you use -f, then testing for a directory is unnecessary.

  If [[! -f "$ f" || $ # -lt2]]; Then exit 0f   

By the way, if this is an error, you should get away from something other than 0-0, in most cases, success indicates; Exit 1 will be better.

No comments:

Post a Comment