idank / bashlex

Python parser for bash
GNU General Public License v3.0
552 stars 94 forks source link

`for f in $(a; b); do :; done` not supported #4

Closed Artoria2e5 closed 8 years ago

Artoria2e5 commented 8 years ago

This happens on explainshell.com.

idank commented 8 years ago

Can you give a complete example? One of the links on the front page is

for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l 2>/dev/null; done On Oct 26, 2015 5:04 PM, "Mingye Wang" notifications@github.com wrote:

This happens on explainshell.com.

— Reply to this email directly or view it on GitHub https://github.com/idank/bashlex/issues/4.

Artoria2e5 commented 8 years ago

( IFS=/; set -ef -- /D/a-b*; for f in $(ls -rtd "$@"; echo /); do [ -n "${f##D*}" ] || continue; mv "${1%/*}/${f%?}" "/r${1%/*}-a"; done ).

Sorry for making such premature conclusion on the title.

Artoria2e5 commented 8 years ago

Tracked down to for f in $(a; b); do :; done. Updating title..

idank commented 8 years ago

It seems like any command substitution with a comma doesn't work, even $(a; b).

Artoria2e5 commented 8 years ago

Hmm. Backtick ones work though.

idank commented 8 years ago

Yeah, I'll have to walk through the code with a debugger to see what's wrong. ETA: unknown. :(

Artoria2e5 commented 8 years ago

Wow.