The commented line in the following bash script is not working. I
notice the following description from man bash and I think that it is
the reason. But I'm not completely sure. Would you please confirm it
for me?
Also, I'm wondering where this decision was made. Can't bash be made
more powerful by allowing the commented line? Will it cause any
problem if such thing is allowed?


#!/usr/bin/env bash

parameter=abcdefg

#for i in {0..${#parameter}};
for i in {0..7};
do
  echo $i ${parameter:$i}
done


       Brace expansion is performed before any other expansions, and any char‐
       acters  special to other expansions are preserved in the result.  It is
       strictly textual.  Bash does not apply any syntactic interpretation  to
       the context of the expansion or the text between the braces.


-- 
Regards,
Peng

Reply via email to