Hi,
I am trying to execute a touch command (am open to any other commands as well). In the shell script I want to perform something like this:
IF [ touch file1.txt ]
THEN
// File didn't exist but it has been created now
ELSE
// File already exists
END
Now I know i can do, IF file_exists but I want to touch a file and ensure that very instant when I touched the file was created and it didn't exist before. Hence if I can't do IF file_exists and then touch.
I want to execute a command (any command, please suggest) that will create the file and along with that return a result to a IF statement informing it about the file creation, else if the file existed then it must not be recreated.
I know this is a little convoluted explanation but it would really help if you can answer this, please ask any clarification questions as well.
Start Free Trial