I was finding it more and more difficult, not to mention irritating, to have to change working directories and open up the appropriate folders when working on oft repeated tasks on my Ubuntu machine. So I patched together a small script - complete with autocomplete...
For example, when i am working on assignments for my course work, I need
So if i'm working on a project that is called "spicetools", i simply open a terminal and enter "init spicetools" and all my required windows are open. (I even do git fetch and git merge)
Nesting:
One unexpected feature is that nested 'init' commands are possible. So if i'm working on project X, I start by doing "init X". Then someone comes and interrupts me to ask about project Y. All i do is "init Y" and i'm now in Y. After i'm done all I do is key in "exit" and I'm back where I was in Project X!
The script itself can be downloaded from here. Remember to add execute permissions when it is saved on your machine. Copy it into your ~/bin/ directory so that you do not have to specify the full path each time.
Try the script with "Init X". Open it in a text editor, read it and make modifications as you require.
Afterword:
I realised, after having created the script, that I was forgetting the keywords I had assigned for the various projects. As a result I created a script to do autocompletes on the bash terminal.
You can download my autocomplete file (init.autocomplete) from here. This file must be placed in /etc/bash_completion.d/, and then start a new terminal. To add more options to the autocomplete, simply edit the autocomplete script.
TODO:
The init.autocomplete, when placed in /etc/bash_completion.d/ gets executed when a new terminal is started. So it can be made to read the init script itself and figure out what are the available keywords.
For example, when i am working on assignments for my course work, I need
- A terminal with the correct working directory (something like ~/Coursework/Assignments/)
- Nautilus showing the contents of this folder
- PDF documents in this folder opened
- Octave open
- A terminal with a different working directory
- Source files opened in an editor
- Firefox showing certain webpages.
So if i'm working on a project that is called "spicetools", i simply open a terminal and enter "init spicetools" and all my required windows are open. (I even do git fetch and git merge)
Nesting:
One unexpected feature is that nested 'init' commands are possible. So if i'm working on project X, I start by doing "init X". Then someone comes and interrupts me to ask about project Y. All i do is "init Y" and i'm now in Y. After i'm done all I do is key in "exit" and I'm back where I was in Project X!
The script itself can be downloaded from here. Remember to add execute permissions when it is saved on your machine. Copy it into your ~/bin/ directory so that you do not have to specify the full path each time.
Try the script with "Init X". Open it in a text editor, read it and make modifications as you require.
Afterword:
I realised, after having created the script, that I was forgetting the keywords I had assigned for the various projects. As a result I created a script to do autocompletes on the bash terminal.
You can download my autocomplete file (init.autocomplete) from here. This file must be placed in /etc/bash_completion.d/, and then start a new terminal. To add more options to the autocomplete, simply edit the autocomplete script.
TODO:
The init.autocomplete, when placed in /etc/bash_completion.d/ gets executed when a new terminal is started. So it can be made to read the init script itself and figure out what are the available keywords.
No comments:
Post a Comment