- [[ ]]
- -e
Conditionals in Bash
Insted of real conditionals in Bash we only have a way to some command was successful or not and the if will execute code based on this condition.
What does it mean a program is successful or not? Exit code 0 or anything else. $?
examples/bash/if_file_exists.sh
#!/usr/bin/env bash filename=$1 if [[ -e $filename ]]; then echo "File $filename exists" fi