Determining the base directory of a bash script

While writing bash scripts, I find it a good idea to put reusable functions into their own scripts and then source them into other scripts.

This means that one must use the source /file/to/source call to load these files. To be able to do this, the bash script must know where the scripts to source are. To not have to hardwire this into the script, I just have the requirement, that the script must be in the same directory as the script itself.

The following code shows how one can find the base directory, with out using any external commands and it should work with out regards to how the script is called:

SCRIPT_NAME="${0##*/}"
SCRIPT_DIR="${0%/*}"

# if the script was started from the base directory, then the 
# expansion returns a period
if test "$SCRIPT_DIR" == "." ; then
  SCRIPT_DIR="$PWD"
# if the script was not called with an absolute path, then we need to add the 
# current working directory to the relative path of the script
elif test "${SCRIPT_DIR:0:1}" != "/" ; then
  SCRIPT_DIR="$PWD/$SCRIPT_DIR"
fi

# now we can source our other scripts
source $SCRIPT_DIR/logger.sh

Ubuntu 10.04 and Lucid Lynx: No icons in menu or buttons

For the Ubuntu 10.04 Lucid Lynx, the developers decided to remove the Interface tab in System -> Preferences -> Appearance.

What made them do that I can not fathom. Yet there is (still) an option to put the icons back.

You can put it back for all new users by adding the following two lines to /usr/share/gconf/defaults/10_libgnome2-common:

/desktop/gnome/interface/menus_have_icons       true
/desktop/gnome/interface/buttons_have_icons      true

And you can activate it again for your current user by using these two commands:

gconftool-2 --type bool --set /desktop/gnome/interface/menus_have_icons        true
gconftool-2 --type bool --set /desktop/gnome/interface/buttons_have_icons       true

I just really hope support for this isn’t removed altogether in new Gnome versions

Courtesy of the following two ubuntu forum threads:
No icons in context menu for 9.10
GTK menus missing icons

Australia, Day 41

Day 41, Tuesday, March 16 2010
————————————

Today I enjoyed the city of Sydney. I went alone in the early morning and walked around the city centre of Sydney, loosing myself in the many streets. Every now and then I found a book store, into which I just had to go. It was interesting to see that every book store had a different assortment, with minor overlappings. For instance, one had more spiritual books, the other more language books, then another was only fantasy, horror and science fiction books.

I ended up in Darling Harbour, where I then went to the IMAX and watched Under The Sea and Avatar both in 3D. That was a good afternoon.

In the evening I met with Iris, but we didn’t do much anymore. We went to bed early, where I first packed my suit case and then read a bit. Once in bed I listened to a chapter of Harry Potther and the half blood prince.

Australia, Day 40

Day 40, Monday, March 15 2010
————————————

Our trip to the Blue Mountains was on this day. It started off with us having to find the Oz Experience office. It was on the other side of town and thanks to good instructions from Laurence at the reception and a quick train ride we were on time waiting for our bus driver. Our bus driver is called Jason. He is a strange bloke. It told us a bit too much of his private life, but he was nevertheless very informative and the day was quite nice.

The trip starts off with a long drive through the heavy Sydney morning traffic. Afterwards we went to a camp spot in the blue mountains, where were supposed to be able to spot kangeroos. Animals are not predictable, so we were not too upset that we didn’t see any. Jason said that he mostly does see them, but today we ran into bad luck.

I was actually not all too happy with this hunt, because I didn’t want to go to a spot, where I saw a mown lawn and maybe have an opportunity to see some kangeroos. For me it would have been better if we had extended the walks. After conferring with the guides at the hostel, they said that was how someone spoke who already had seen kangeroos. Other people would come to Sydney for three days and would want to see a kangeroo, so that was why this part was incorporated into the trip. I suppose they are right.

Our trip continued on to the Wentworth Falls walk. This is a beautiful little round circuit from the car park, which goes down a bit into the valley and gives a wonderful view over the blue mountains valley and the of the Wentworth Falls. It took us about one and a half hours to do the walk.

We stayed at the car park after the trip and then had our lunch their. Sadly I had not told them about me being vegan so all I had for lunch was lettuce, tomatoe and cucumber. They didn’t even serve some italian dressing, salt or any other kind of flavouring! That definitely was not good. I have definitely been served well, especially if I think about our Uluru trip…

The next and last walk consisted of the walk down to the base of the scenic railway, which takes one down a large set of stairs. In the early days, these steps were taken by miners, which would go down them in the morning and come up with the railway after their work ended. This walk was very nice as we walked through many crevices in the side of the mountain, had a beautiful view and also ended up with a view on to the three sisters. Here we stopped and our guide told us the story of how the three sisters came to be in the aboriginal world.

The last walk concluded our trip, and we started the trip back into Sydney. The trip was very nice, yet 100 AUD was not quite adequate for what we had. It was too little walking, but I suppose that is just me, who loves walking in nature…

The evening was concluded with a BBQ which was provided by the hostel.

Australia, Day 39

Day 39, Sunday, March 14 2010
————————————

This morning was my last couple of hours in Tasmania, which was quite sad since I had such a fabulous time… But oh well, swapped the pictures we made on the hikes and Monika gave me some good music which I had heard on the way to and back from Coles Bay. Most were australian interprest like: The Presets, Lisa Mitchell, The beautiful girls, The Temper Trap, Wolfmother, Xavier Rudd, etc.

As time was running out, I packed my bags into the car, and we then headed out. Monika took me up the wine route for a couple of kilometres where I was able to enjoy a beautiful view over Launceston and of the Vineyards which were on the highway.

As a last stop, we went to the gorge in Launceston, where I saw what I was going to miss, as there was no time left for me to walk around through the gorge and enjoy another nice hike.

So, with a few minutes after two, we arrived at the airport. Sadly this was good-bye. I had immensly enjoyed the time with Monika in Tasmania, and was sorry to leave, but nothing is forever and I might see her soon, when she would be doing her next trip to Europe…

Australia, Day 38

Day 38, Saturday, March 13 2010
————————————

Today we had decided on doing the circuit around Frecinet National Park, to Wineglass Beach, Coles Beach and through the beautiful coast line. We were walking from one beautiful little place to the next, through thicker bush which was really beautiful, then again through more open stretches, and always having a glimpse of the water. It was a long hike, especially after the strains of the previous day. We made it after about six hours. We had lunch on Coles Beach where we watched the water crash onto the rocks on which we were sitting. It was really wonderful.

Once we had arrived back at the carpark and relieved our feet from the hiking boots, we started our trip back home. Once we had arrived in Launceston, we immediately drove to the burger place Burger Got Soul. Monika said they have wonderful burgers and even vegan ones, which I was not going to miss out on. We took the burgers back to Monikas place where we then ate them, while watching the eighth season of Scrubs. We laughed our heads off, while eating really good burgers. Thanks Monika for that idea, as this was another nice meal.

Australia, Day 37

Day 37, Friday, March 12 2010
————————————

In the morning we got up around 8:30 and then prepared to go out to the Frecinet National Park which is situated in the east of Tasmania. It was a two and a half hour drive to coles Bay. We stopped in the middle of the drive in Campbell Town where we had a little break. Coles Bay is just outside of the national park and we got there sometime in the early afternoon.

After paying the fee for the national park we decided on the possible routes. There are a number of different walks which can be done around in Frecinet National Park and many involve view of Wineglass Bay which is a really beautiful area.

Much discussion later, we decided on Mt Amos which was to be a very steep and difficult hike, yet wonderfully rewarding. The hike consisted of simple walkways and the very difficult climbs over stone slabs which were very slippery. Due to the fact that it was dry, we were able to walk up to Mt Amos, which took us about two hours. The view from the top was astonishing, but we did not stay long as we didn’t want to loose the day light and then walk in the dark down the steep stone slabs.

When the hike was over, and we were really tired, we checked in at the local YHA and went to the pub for dinner. There wasn’t much I was expecting from the pub, but I was really lucky because they had a wonderfuly curry which was vegan. So this was my second best dish since being in Australia. Monika wanted me to try some of the beers so she showed me what a Boags Premium tastes like. I quite liked it.

Australia, Day 36

Day 36, Thursday, March 11 2010
————————————

In the morning I got up, took a shower and then packed my things and headed out for a coffee with Vicky. Afterwards we got back, checked-out and it was nearly time for my flight to Tasmania. The shuttle bus picked me up at quarter past eleven. The shuttle picked some more people up and I was starting to get a little nervous as my time was running out. Finally we headed off to the airport and I saw that I had less than half an hour left to check-in. Everything did work out well and I was ontime to catch my short flight to Tasmania.

While waiting at the tasmanian airport for Monika to pick me up, an elderly lady took place on the bench next to me. We came into conversation and she told me, that she had come to Tasmania to watch her grandson shave off his long hair for a good cause. The grandson wants to raise 50’000 AUD for cancer patients. She said she found it good that he shaved off his hair for the good cause, but was secretly also happy because she didn’t like the long hair on him =)). I had to smile to myself.

Soon after her granddaughter in law picked her up, Monika also arrived. After a warm welcom greeting she took me to her place. She lives together with two other girls, Carmul and Nicky (Hopefully I remembered correctly…). Carmul is a teacher of art and was currently at home. Nicky was not there as she was visiting her grandmother who was very ill. THe house is a beautiful little home and was very inviting.

The three of us went to a vietnamese restaurant, where a table was reserved for us. I had the best meal at this little restaurant since I have arrived in Australia. It was a wonderful rice dish with shitake mushrooms and many vegetables. I really enjoyed it. We had a very nice and easy going conversation and I had a very good time.

Australia, Day 35

Day 35, Wednesday, March 10 2010
————————————

Brado’s backpackers is quite a nice place to be. The place itself is still pretty run down, but as Brad, Laurence and his crew only took over the place some 5 weeks ago, they are only just finding out what has to be done. I am deeply impressed by the friendliness of the place. Brad and Laurence used to be tour guides and now have decided to have a backpackers of their own. Because they are tour guides, Brad supposedly got Beaver his job, have firstly lots of experience on how bad accommodations can be, but also they have decided to keep the touring up by offering really wonderful tours of the city.

One of these tours we did today. This was a tour which took us down to the city, and into the Royal Botanical Gardens. Sadly the weather had changed and we were once again under cloudy skies with a few drizzles and some rain during the day. Nevertheless the view was really beautiful. Our walk took us down to Wolloomooloo Bay. On the way there, we came down a flight of stairs, where Brad, or Forest for which he is better known, told us about the TV show Underbelly. Underbelly was written on the grounds of the true stories which brought about the murder of 32 people. These murders were all conducted in cocaine related situations. The first season of Underbelly told the story of cocaine in Melbourne during the 1990’s. Two more seasons had been shot which told the beginning of how cocaine came to Australia and this originated in Sydney during the 1970’s and thus certain scenes were shot at theses stairs.

We carried on walking along edges of the botanical garden which looked out onto the harbour. The walk carried on, and we then came to the spot where Mrs McQuaries Chair is situated. This chair was once cast out of the rock there by Gouvernour McQuarry because his wife used to walk along the shore and enjoy the view at this place.

Our walk then carried on through the gardens and we ended up on the east bank of Farm Cove, giving us a splendid view of the Sydney Opera House and the Sydney Harbour Bridge. Had the weather not spoiled the view, then we would have had a postcard view of the two beautiful attractions.

We carried on walking and then sat under a larger tree, where Forest then told us a gread deal of how Australia came to be found in a extraordinary secretive mission by Captain Cook in 1770 and then colonized in 1788. He told us how the English landed with a fleet of 11 ships and how they then first told the aborigines to piss off, but because they could not, they began the slaughtering and thus the destruction of a race of people who have survived against all odds in the harshest environments on the planet. A race which has managed, over about 100’000 years, give or take a few, to have survived the deadliest fauna and flora in the world. No race has managed to live as long, not even to have started as long ago. One of the cruelest acts was to not classify them as humans until 1965, before which they were classed as part of the australian fauna and flora!

It is sad to hear all these things, and always reminds me of all the other races which had to undergo similar destruction: native North Americans, native Africans or the native South Americans, the descendants of the Mayas! Nevertheless it was mesmerizing to listen Forest speak and it was really nice to feel the empathy which he has towards the Aborigines.

After a long time of speak, we broke the talking and headed off as first the weather was about to collapse on top of us and we were going to be late for lunch. Lunch was held in Sydneys oldest pub and it is filled with information and pictures of the discovery of Australia and the start of the colonization with the arrival of the fleet of 11 ships.

After lunch we headed off to the Harbour Bridge. We walked up the old stairs which takes one up to the pedestrian lane on the bridgt. It was quite a view from there, but we then carried on to the top of one of the four corner pillars. The pillar is a small museum of the building of the bridge and at the top one could enjoy a wonderful view over Sydney.

The Sydney Harbour Bridge marked the end of our tour of the city and everyone dispersed in different directions. The evening was easy going, and we soon turned in for the night as Iris would leave for Adelaide early the next day and I would leave for Tasmania around midday.