I\'d like to know if it\'s possible to change the current terminal directory from where I\'m executing my ruby script.
For example, if I\'m executing the script from
Maybe slightly easier,
You can use exec in combination with Maerics post about creating a new bash shell inside of ruby to achieve this.
exec ruby -e "Dir.chdir( 'mydir' ); exec 'bash'"
exec
will replace the parent process(shell) with the child process (ruby), thus the shell no longer exists (no need to exit).
At the end of the ruby routine bash is fired up (again with exec
this time in ruby) in the new directory and replaces the ruby process.