3

I have a script to decrypt an encrypted file - but I only want to do it if the file exists.

bash -c "openssl rsautl -decrypt -inkey key.pem -in encrypted.dat -out decrypted.txt" 

Is there an easy way to only do this if the .dat file exists?

0

1 Answer 1

2
if [ -e encrypted.dat ]; then echo exists; else echo does not exist; fi 
Sign up to request clarification or add additional context in comments.

2 Comments

what the fi at the end?
@user3437721: The fi marks the end of the if statement, like the then marks the start of the body of the if statement and the else marks the end of the body of the if and the start of the else clause.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.