解决shell脚本for i in {0..10}输出{0..10}的问题

#!/bin/bash
for i in {0..10}; do
  echo $i;
done;

输出的却是{0..10}就这么一个字符串。

 

解决方案:

你执行这段文件用的不是bash,  是debian自己实现的dash(debian系的/bin/sh默认指向/bin/dash)

你可以直接

/bin/bash  example.sh

或者让sha-bang生效

chmod +x example.sh

./example.sh

 

参考:https://www.oschina.net/question/1047640_156390

posted @ 2017-05-21 11:46  夜雨西风  阅读(7561)  评论(0编辑  收藏  举报