닭발개발

[Linux] $ pwd --version 했을 때, invalid option 뜨는 이유 본문

Linux

[Linux] $ pwd --version 했을 때, invalid option 뜨는 이유

D269 2023. 9. 4. 14:57
728x90

 

$ pwd --version 을 하면 invalid option이라고 뜬다.

test@test319:/mnt/c/WINDOWS/system32$ pwd --version
-bash: pwd: --: invalid option
pwd: usage: pwd [-LP]

 

원인

pwd의 위치를 보면

test@test319:/mnt/c/WINDOWS/system32$ which pwd
/usr/bin/pwd

 

 

/usr/bin/pwd --version 하면 오류 없이 잘 된다.

test@test319:/mnt/c/WINDOWS/system32$ /usr/bin/pwd --version
pwd (GNU coreutils) 8.32
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jim Meyering.

 

 

 

$ pwd --version  와  $ /usr/bin/pwd --version 둘의 차이는?

리눅스 shell 명령어에는 우선순위가 있다.

 

Alias => Function => Built in => Executable File 순으로 실행되는데,

그냥 $ pwd --version 은 Build in된 pwd를 실행한 거고,

/usr/bin/pwd 의 pwd 를 실행해야 하기 때문에 절대경로를 명시해 줘야 한다.

 

 

 

 

 

 

 

728x90
반응형