Views:
2,753
Votes: 1
✅ Solution
Tags:
command-line
bash
Link:
🔍 See Original Answer on Ask Ubuntu ⧉ 🔗
URL:
https://askubuntu.com/q/1196192
Title:
syntax error near unexpected token `
ID:
/2019/12/14/syntax-error-near-unexpected-token-_
Created:
December 14, 2019
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
The command itself works fine:
$ for d in */; do echo "$d" ; done
subdir-A/
subdir-B/
However you have a hidden '
in front of the for
command. Perhaps the file was copied from Windows. The easiest solution is to create a new test.sh
file and copy the above command into it.