To make a bash script that will cd to a select directory:
Create the script file
#!/bin/sh
# file : /scripts/cdjava
#
cd /home/askgelal/projects/java
Then create an alias in your startup file.
#!/bin/sh
# file /scripts/mastercode.sh
#
alias cdjava='. /scripts/cdjava'
I created a startup file where I dump all my aliases and custom functions.
Then I source this file into my .bashrc to have it set on each boot.
For example, create a master aliases/functions file: /scripts/mastercode.sh
(Put the alias in this file.)
Then at the end of your .bashrc file:
source /scripts/mastercode.sh
Now itws easy to cd to your java directory, just type cdjava and you are there.
     
    
pwdon last line. So before script finish then you can check is it working or not..cdlocated?xdotool type --clearmodifiers 'cd ~/projects/java' && xdotool key KP_Enter