This may have been addressed already somewhere, however I am looking for the easiest/shortest way to validate a response from a user for a file name.
The file name should not have any of the following characters
~`!@#$%^&*()_-+={[}]|\:;"'<,>.?/
Further the response should not have any control characters or non printable characters.
Please advise which utility to use for this purpose. I am kind of leaning toward either a tr or sed or grep command. Please advise. Thanks.
Jean-Pierre. Thanks for your quick response.
This code works fine except when I enter "*" for the file name, then the shell expands all of the current files within my current folder where I have the shell script running and returns that the name of the file is valid, which we know is not true. How can I overcome this? Thanks. Jerardfjay
Sorry. This code works fine. There were other checks which were causing the error and not this piece of code. Thank you.