Sobes.tech
Junior

How to write a condition in one line in Bash?

sobes.tech AI

Answer from AI

# Check if the file exists and is not writable
if [ -f "myfile.txt" ] && ! [ -w "myfile.txt" ]; then echo "File exists but is not writable"; fi