IT

0222 UNIX 019. sh 쉘 if else 구문중 : 사용하기

띠앗머리 2016. 1. 26. 17:46

내용

#!/bin/sh

echo "Input check username : \c"

read username

if grep "$username" /etc/passwd > /dev/null 2>&1

then

 #echo "$username found!"

 :

else

 echo "$username not found!"

 exit 1

fi

설명

null 코맨드인 : 코맨드는 내장 코맨드인데 아무 일도 해주지 않는다. 다만 exit status 값을 0 으로 되돌릴 뿐이다.