[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Determinate the directory whithin a script



Paolo Pantaleo wrote:

>I have a script in something like

>/media/sda1/backup/script.sh

>since sda1 could be also sda2 or anything, I want to determintate at
>run-time what is the directory in which the script is located, how can
>I do?

Here's an unportable implementation dependent way:

script_dir=$(dirname $(readlink /proc/$$/fd/255))



Reply to: