I am trying to define a bash function, mycd. This function uses an associative array mycdar. If the key exists in the array the function will change directory to the corresponding value of the key. If the key doesn’t exist it will change to the dir provided in the command line.
What I would like to do is to have completion for this function, from both they keys of the associated array or from the folders existing in the current directory.
Thank you.
Building my own
cdfunction with completionUsing an associative array for storing some paths.
First the command:
Second the completion command
One array:
Than finaly the bind:
Or to permit standard path building behaviour: