Quote:
Originally Posted by cparky2
I would like the commands entered by users of this environment to be checked against a database of commands.
|
Well, what part of this are you having difficulty with? You can set up a database (or even just a list of strings in your program) and check if the command entered is in this list.
Quote:
Also i would like a simple application that would say success or fail depending on the outcome of a command. For instance, if the tutorial asked them to set chmod commands to 777 then it would say success if it had been applied properly.
|
Again, what part of this are you struggling with? For each task, you would have to define a list of criteria which check if the command has been executed correctly (e.g.
Code:
ls -l commands | grep "^-rwxrwxrwx" -q
for your example) and then get the program to execute each command in turn and check their return code: if they all return 0 for success, print "success", otherwise you can print an error message appropriate to which command failed.