"n"커맨드의 첫 번째 라인만을 제공하는 bash 스크립트를하려고합니다.커스텀 아웃풋을 가진 남자를위한 bash 스크립트
예 :
$ sh ./start.sh ls wazup top
ls - list directory contents
wazup - manpage does not exist
top - display Linux tasks
이 내 현재 코드입니다 :
! bin/bash/
while [ -n "$1" ]
do
which $1> /dev/null
man $1 | head -6 | tail -1
if [ $? = 0 ]
then
echo "manpage does not exist"
fi
shift
done
내 출력은 다음과 같습니다
ls - list directory contents
manpage does not exist
No manual entry for wazzup
manpage does not exist
top - display Linux processes
manpage does not exist
0의 종료 상태 성공합니다 (C-스타일 부울 대회의 반대)을 나타냅니다 :
는 여기를 필요로 누군가를 위해 내 마지막 코드입니다. 0이 아닌 값은 실패를 나타냅니다. – chepner