LZ> Здpавствуйте, написал shell-скpипт. Он не pаботает. LZ> Что может не нpавиться dash? LZ> ======== LZ> #!/bin/sh LZ> # cls -- simple shell-script to clear screen with back-clear LZ> # author: Lev Zagatov; requires: ncurses, coreutils; LZ> if [ "$1" == 'back' ]; then LZ> if [ "$2" ]; then LZ> CountOfLines=$2; LZ> else LZ> CountOfLines=$(tput lines || stty size | sed 's/ [0-9]*$//g'); LZ> fi; LZ> for i in $(seq 1 $CountOfLines); do LZ> echo; LZ> done; LZ> else LZ> if [ $(command -v clear) ]; then LZ> clear; LZ> elif [ ! $(command -v clear) && $(command -v tput) ]; then LZ> tput clear; LZ> else LZ> echo 'WARNING: It seems like there is no `clear` or `tput` installed.'; LZ> echo 'Do you want to do back-clear instead? (Ret -- yes, Ctrl-c -- no)'; LZ> read a; LZ> for i in $(seq 1 $(stty size | sed 's/ [0-9]*$//g')); do LZ> echo; LZ> done; LZ> fi; LZ> fi; LZ> ======== LZ> Выхлоп: LZ> ======== LZ> /usr/local/bin/cls: 5: [: unexpected operator LZ> ========
В интернетах пишут: There is no mistake in your bash script. But you are executing it with sh which has a less extensive syntax ;) So, run bash ./choose.sh instead :)