NewtownGuy
Technical User
Hello,
I am using Ubuntu Server 10.04 LTS. I have a problem specifying a directory within a bash script that I run via a symbolic link.
I start the task using a symbolic link to it in /etc/cron.hourly/. The scripts that I want to run are in /var/ and data each one needs are in /var/ My script does "cd ../" to try to get data from its parent directory, but the parent directory is /etc/cron.hourly/, the location of the symbolic link, so the reference fails.
I have tried "cd ." in the task, but that leaves me in /etc/cron.hourly/ rather than the location of the executable. I have many tasks like this and I don't want to have to hard code their folder names into each one.
How do I tell my executable to change the current working directory to its location ?
Thank you in advance.
I am using Ubuntu Server 10.04 LTS. I have a problem specifying a directory within a bash script that I run via a symbolic link.
I start the task using a symbolic link to it in /etc/cron.hourly/. The scripts that I want to run are in /var/ and data each one needs are in /var/ My script does "cd ../" to try to get data from its parent directory, but the parent directory is /etc/cron.hourly/, the location of the symbolic link, so the reference fails.
I have tried "cd ." in the task, but that leaves me in /etc/cron.hourly/ rather than the location of the executable. I have many tasks like this and I don't want to have to hard code their folder names into each one.
How do I tell my executable to change the current working directory to its location ?
Thank you in advance.