我试图弄清楚是否有一种标准方法(不是有效的 hack)来了解当前在 POSIX shell 脚本上执行的函数的名称。我知道我可以用 . 返回脚本的名称$0。如何应用类似函数的东西?
$0
posix sh
符合POSIX的shell应提供这样的机制来迭代字符串集合:
for x in $(seq 1 5); do echo $x done
但是,如何迭代单词的每个字符?
shell posix sh dash-shell
posix ×2
sh ×2
dash-shell ×1
shell ×1