데비안 짜기 amd64가 있습니다. 내 현재 쉘은 bash입니다. 터미널에 다음을 쓰면 작동합니다.
$ uname -a
Linux core 2.6.32-5-amd64 #1 SMP Fri May 10 08:43:19 UTC 2013 x86_64 GNU/Linux
$ echo $SHELL
/bin/bash
$ echo $(realpath test.sh)
/home/ffortier/test.sh
내 test.sh 파일은 다음과 같습니다.
#!/bin/bash
echo $(realpath "$1")
다음을 실행하려고하면 오류가 발생합니다.
$ ./test.sh test.sh
./test.sh: line 2: realpath: command not found
bash 파일 내에서 realpath 명령을 어떻게 사용합니까?
추가 정보
$ type -a realpath
realpath is a function
realpath ()
{
f=$@;
if [ -d "$f" ]; then
base="";
dir="$f";
else
base="/$(basename "$f")";
dir=$(dirname "$f");
fi;
dir=$(cd "$dir" && /bin/pwd);
echo "$dir$base"
}