Hi there,
im writing a script and trying the get the 2nd parameter and check it if its valid file or valid directory,
Example:
./test -a quiz1
i need to check quiz1 ($2)
if it matches any name of a file or directory.
Thanks
Hi there,
im writing a script and trying the get the 2nd parameter and check it if its valid file or valid directory,
Example:
./test -a quiz1
i need to check quiz1 ($2)
if it matches any name of a file or directory.
Thanks
Sorry dude, can't post test/homework questions here. You should google shell test syntax for clues.
0ops, you missed understanding, its not homework or quiz, its just exercise from a book.
Ive googled before i post, and i got some result but didn't work quit right,
i wont post something and wait long to get reply for it since i can search it.
but still thanks for trying.
And here is the basic solution:
#!/bin/sh
ls $2 2>&1 ; test $? -gt 0 && echo NOK || echo OK