I wanted to create a really simple script. Along with changing the working directory I wanted to see the directory's content.
At first I tried sth. like:
# file dir.sh
But then I realised that every new proccess has a new working directory. So I've tried calling it like:
And yes! It worked!
But to achieve perfect solution I want to create an alias for 'cd'. So I modified my .bashrc by adding a line:
alias cd=". ./dir.sh"
The result of 'cd' after reloading bash was an infinite loop and segmentation fault. Then I realised, that the command 'cd $1' in dir.sh was changed due to the alias on 'cd'. And here I'm stuck. Any hints?