basename --help
Usage: basename NAME [SUFFIX] or: basename OPTION
Print NAME with any leading directory components removed. If specified, also remove a trailing SUFFIX.
--help ÀÌ µµ¿ò¸»À» Ç¥½ÃÇÏ°í ³¡³À´Ï´Ù --version ¹öÀü Á¤º¸¸¦ Ãâ·ÂÇÏ°í ³¡³À´Ï´Ù
Examples: basename /usr/bin/sort Output "sort". basename include/stdio.h .h Output "stdio". |
ÆÄÀÏ¸í¿¡¼ °æ·Î Á¤º¸¸¦ ¶¼¾î³»°í ¿ÀÁ÷ ÆÄÀÏ À̸§¸¸ º¸¿© ÁÝ´Ï´Ù. basename $0 À̶ó°í ÇÏ¸é ½ºÅ©¸³Æ®´Â ÀڱⰡ ½©¿¡¼ ºÒ¸° ÀÚ±â À̸§À» ¾Ë ¼ö ÀÖ½À´Ï´Ù. ½ºÅ©¸³Æ®¿¡ ÇÊ¿äÇÑ ÀÎÀÚ°¡ ¾øÀÌ ½ÇÇàµÇ´Â °æ¿ì¿¡ "»ç¿ë¹ý" ¸Þ¼¼Áö¸¦ ÂïÀ» ¶§ ¾µ ¼ö ÀÖ½À´Ï´Ù.
dirname --help
Usage: dirname NAME or: dirname OPTION
Print NAME with its trailing /component removed; if NAME contains no /'s, output `.' (meaning the current directory).
--help ÀÌ µµ¿ò¸»À» Ç¥½ÃÇÏ°í ³¡³À´Ï´Ù --version ¹öÀü Á¤º¸¸¦ Ãâ·ÂÇÏ°í ³¡³À´Ï´Ù
Examples: dirname /usr/bin/sort Output "/usr/bin". dirname stdio.h Output ".". |
ÆÄÀÏ¸í¿¡¼ basenameÀ» ¶¼¾î³»°í ¿ÀÁ÷ °æ·Î Á¤º¸¸¸ º¸¿©ÁÝ´Ï´Ù.
Âü°í: basename°ú dirnameÀº ¾î¶² ¹®ÀÚ¿¿¡ ´ëÇؼµµ µ¿ÀÛÇÕ´Ï´Ù. ÀÌ ¸í·É¾îµé¿¡ ³Ñ°ÜÁÙ ÀÎÀÚ´Â ²À ½ÇÁ¦·Î Á¸ÀçÇÏ´Â ÆÄÀÏÀÌ ¾Æ´Ï¿©µµ µË´Ï´Ù
ex)
#!/bin/bash
tmp=/usr/local/src/httpd-2.2.11.tar.gz
echo "basename = `basename $a`" echo "dirname = `dirname $a`" exit 0
### ½ÇÇà°á°ú ###
basename = httpd-2.2.11.tar.gz dirname = /usr/local/src |