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?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
user3437721
  • 2,227
  • 4
  • 31
  • 61

1 Answers1

2
if [ -e encrypted.dat ]; then echo exists; else echo does not exist; fi  
balabhi
  • 641
  • 5
  • 5