Question: I have a script that loads a set of form controls based off of the selection made in a drop-down list. I load the elements from a php file in to a `div` using the following code: 

```
<script>
$(function() {
  $('#prompt_type').change(function() {
        switch ($( this ).find(":selected").text()) {           
            case 'Select': 
                $('#prompt_elements').load('index.php?path=promptelm&and_id=' + <?php echo $and->and_id; ?> + ' #type_select');
                break;                              
            case 'Radio':
                $('#prompt_elements').load('index.php?path=promptelm&and_id=' + <?php echo $and->and_id; ?> + ' #type_radio');          
                break;
            case 'Checkbox':

```

This part works great. My issue however is I am saving this information to a database and when I revisit the form even though my drop-down contains the correct value the elements are not loading unless I reselect the option to spark the `.change` event again. Is there a way to call my switch right after the drop-down is loaded?

Answer: 
Three comments on that function. This will work *mostly*. To catch some corner cases:

1. Either use `function mkcd { ...; }` or `mkcd() { ...; }`. The first is compatible with `ksh`, but only if you drop the `()`. The `mkcd()` notation is the standard POSIX notation.
2. Even `mkdir -p` can fail, so make the `cd` conditional on `mkdir`.
3. Finally, you want exactly one argument to `mkdir` and `cd`. Use only one argument, and test that it has a value with the `:?` modifier in parameter substitution. This will stop the function from sending you `$HOME`.

Together:

```ksh
function mkcd
{
    mkdir -p "${1:?}" && cd "${1}"
}

```

Put that in your .bashrc and open a new shell. Type `type mkcd`. This should respond with: 

`mkcd is a function`, followed by its definition.
As commented by Henk Langeveld and hek2mgl: "Wrong shell. Badly placed ()'s is a message produced by tcsh. Switch to bash or ksh."

I thought that opening a terminal on ubuntu entered straight into bash environment. In fact, as commented below, "a Terminal will start a copy of your login shell as defined in /etc/passwd". By typing `ps -p $$` in terminal, I realise mine is set to tcsh, the C shell. In that case, one needs to type `bash` to get into bash environment.

Then `source ~/.bashrc` compiles the definition for mkcd.