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

Re: Determinate the directory whithin a script

On 6/18/06, Paolo Pantaleo <paolopantaleo@gmail.com> wrote:
I have a script in something like


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?

pwd doesn't work, since I cuold call the script from some other direcotry

The following shows a possible solution:


cd "`dirname $0`"
cd "${current_dir}"

echo ${script_dir}

My 2 cents,

Reply to: