readlink: illegal option -- f

Posted by Scott on Server Fault See other posts from Server Fault or by Scott
Published on 2012-12-07T10:10:03Z Indexed on 2012/12/07 11:07 UTC
Read the original article Hit count: 299

Filed under:
|
|

Recently the script was working fine, but from some days I'm receiving such message, while running the readlink -f "$0" command:

readlink: illegal option -- f
usage: readlink [-n] [file ...]

I was running the following code to debug:

#!/bin/sh

DIR=`pwd`
RLPATH=`which readlink`
RLOUT=`readlink -f -- "${0}"`
DIROUT=`dirname -- ${RLOUT}`

echo "dir: ${DIR}"
echo "path: ${PATH}"
echo "path to readlink: ${RLPATH}"
echo "readlink output: ${RLOUT}"
echo "dirname output: ${DIROUT}"

Output:

# ./debug.sh
readlink: illegal option -- f
usage: readlink [-n] [file ...]
usage: dirname string [...]
dir: /home/svr
path: /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
path to readlink: /usr/bin/readlink
readlink output:
dirname output:

What is wrong ?

© Server Fault or respective owner

Related posts about bash

Related posts about unix