=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-­=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-­=-=-=-=-=
                             UNIX GURU UNIVERSE
                                UNIX HOT TIP

                       Unix Tip 2416 - August 13, 2006

                   http://www.ugu.com/sui/ugu­/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-­=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-­=-=-=-=-=

다음 이용할 수 있는 UID?

시스템상에서 다음 사용가능한 UID를 찾아내는 한가지 방법을 소개한다.

이 방법은 패스워드 파일과 그룹파일을 동시에 받아 다음 사용가능한 UID를 찾아
화면에 나타내준다.

#!/bin/bash
awk -F":" '{ print $3 }' /etc/passwd > number_list
awk -F":" '{ print $3 }' /etc/group >> number_list
A=` sort -g number_list | tail -1`
A=`expr $A + 1`
echo "New Available UID is $A"

※ 譯者 註 :
        - 괄호부분은 생략함.
        - sort -g : 숫자 정렬
        - awk -F":" '{ print $3 }' /etc/passwd > number_list
           :를 구분자로 하여 /etc/passwd 파일에서 3번째 필드를 number_list 파일에 저장한다.

@@@@@@@@@@@@@@@@@@@@[ 원문 ]@@@@@@@@@@@@@@@@@@@@

THE NEXT UID

Here is one way to find out the
next available UID on a system.

It takes both the password and
group files and finds the next
available UID and displays it.

(No cats were harmed in the making
of this script)

#!/bin/bash
awk -F":" '{ print $3 }' /etc/passwd > number_list
awk -F":" '{ print $3 }' /etc/group >> number_list
A=` sort -g number_list | tail -1`
A=`expr $A + 1`
echo "New Available UID is $A"

반응형
Posted by She쥐포s

블로그 이미지
She쥐포s
Yesterday
Today
Total

달력

 « |  » 2024.3
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

최근에 올라온 글

최근에 달린 댓글

글 보관함