FG
šŸ’» Software

Why do I Get [[: not found When Running a Script?

Fresh5 days ago
Mar 15, 202640721 views
Confidence Score0%
0%

Problem

I'm trying to write a script that has to check if a file exists. In the console I write and I get but when I write a script to do the same thing: and then execute the script, I get this: I saved the script on the current directory and named it ex.sh, then I made sure it is executable. To call the s…

Error Output

if [[ -a /path/to/file.txt ]]; then echo "not mod"; else echo "mod"; fi

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Why do I Get [[: not found When Running a Script?

Low Risk

You are running a script written for bash under sh, which lacks many of the extended syntax features – is a builtin command and is not available in . Change to or to .

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment