On 2013-11-29, Vasily Ivanov wrote: > On 29.11.13 0934 (+0400), Vladimir Skubriev wrote: >> check_rebuild_status(){ >> if [ $(grep "recovery" /proc/mdstat -c) -ne 0 ]; then >> return 0 >> else >> return 1 >> fi >> } >> >> Чтобы было более элегантно. > > check_rebuild_status(){ > grep -q recovery /proc/mdstat > return $? > } >
check_rebuild_status() { grep -q recovery /proc/mdstat } > -q, --quiet, --silent > Quiet; do not write anything to standard output. Exit immediately with > zero status if any match is found, even if an error was detected. Also > see the -s or --no-messages option. (-q is specified by POSIX.) А POSIX то не дочитали...: http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_05_01 2.9.5 Function Definition Command ... Exit Status The exit status of a function definition shall be zero if the function was declared successfully; otherwise, it shall be greater than zero. The exit status of a function invocation shall be the exit status of the last command executed by the function. -- Best regards! -- To UNSUBSCRIBE, email to debian-russian-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87pppjdjdq....@gavenkoa.example.com