#!/bin/sh for n in {1..$RANDOM} do str="" if (( n % 3 == 0 )) then str="fizz" fi if [ $[n%5] == 0 ] then str="$strbuzz" fi if [[ ! $str ]] then str="$n" fi echo"$str" done
shell 它会给出错误提示或者建议:
Line 2: for n in {1..$RANDOM} ^-- SC2039: In POSIX sh, brace expansion is undefined. ^-- SC2039: In POSIX sh, RANDOM is undefined.
Line 5: if (( n % 3 == 0 )) ^-- SC2039: In POSIX sh, standalone ((..)) is undefined.
Line 9: if [ $[n%5] == 0 ] ^-- SC2039: In POSIX sh, $[..] in place of $((..)) is undefined. ^-- SC2007: Use $((..)) instead of deprecated $[..] ^-- SC2039: In POSIX sh, == in place of = is undefined.
Line 11: str="$strbuzz" ^-- SC2154: strbuzz is referenced but not assigned.
Line 13: if [[ ! $str ]] ^-- SC2039: In POSIX sh, [[ ]] is undefined.
system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "$VIM/gvimrc" user gvimrc file: "$HOME/.gvimrc" 2nd user gvimrc file: "~/.vim/gvimrc" system menu file: "$VIMRUNTIME/menu.vim"