### Tips on using Shell windows

#### Set up your bash prompt to show current path

It is convenient set up your bash prompt in your .profile to display the current directory - making it appear in the Status bar rectangle. You may do this by adding the following line to ~/.profile :

    PS1="\$PWD"": "

One convenient way of doing this is activating your Worksheet, typing

    ~/.profile

placing the cursor anywhere in the typed text and pressing Alt-D (Open selection). The .profile file will open and you may edit it. After saving and closing it you may either quit/restart Eddie or execute:

    . ~/.profile

in the Worksheet to activate the change

#### Adding Eddie specific setting to your ~/.profile

You might want to make your Eddie shell behave slightly different than a shell in a Terminal window. To do this, you may add Eddie-specific commands into the .eddieShellProfile or .eddieWorksheetProfile. Also, you may add Eddie- specific commands directly to the ~/.profile file. You may for instance prefer to only have a customized prompt when running Eddie. To do that, you can check the $EDDIE environment variable in ~/profile:

    if [$EDDIE"*" = "*"]; then
    	# add Terminal-only setup commands here
    	# this part gets executed when Eddie is not running (you are running
    	# the shell from Terminal, ARPTelnet, etc.)
    	# set up Eddie for Perforce, use full path (may break if you move the app)
    	export EDITOR='/boot/apps/Eddie/plugins/telEddie -w'
    else
    	# add Eddie specific setup commands here
    	# pwd displaying prompt
    	PS1="\$PWD"": "
    	# set up Eddie for Perforce using the exported EDDIE_HOME variable - this
    	# setup does not depend on the location of the Eddie folder
    	export EDITOR='$EDDIE_HOME/plugins/telEddie -w'
    fi

Note that the bash variable $PROMPT_COMMAND is used by Eddie for capturing the shell prompt and cannot be changed by the user. $PROMPT_COMMAND is typically used in Terminal to change the title of a Terminal window when a directory changes or other setup. Hopefully you will not miss this feature in Eddie. If you do set up $PROMPT_COMMAND in ~profile, you need to place in the non-Eddie part of the if statement in the example above.

#### Getting rid of shell command output.

To get rid of output from say a compile, you may use the Undo feature - the entire shell output will get deleted.

To select all the output an execution of a shell command produced, use Undo and Redo - the output will get deleted, re-inserted and selected.

#### Fixing compile errors when using mwcc.

When fixing syntax errors during a compile using mwcc, select an entire line containing the location of an error, emitted by the Metrowerks compiler, for example select:

    File "$EDDIE_HOME"/'Release notes'; Line 10

and hit Return. Eddie will open the file with the error and select the appropriate line. Note that this is implemented using a shell script, if instead of a full path you use say a shell variable (as in our example) and a partial path, you will get the same result.

#### Fixing compile errors when using gcc.

When fixing syntax errors during a compile using gcc, place the cursor anywhere in the file path name and press Alt-D.

    /boot/home/src/Eddie/shell/filelist/FileList.cpp:1123: parse error before `&'

The file will open. If the error line also contains a line number as in our example, the line will get selected

#### Using grep from the Worksheet.

When using grep from the Worksheet, using the -n option will help opening the resulting files and selecting the corresponding line:

    grep -n AddString */*/*.[ch]*
    filelistwindow/FileListMisc.cpp:472: addMessage.AddString("group_name", name);
    filelist/FileFinder.cpp:169: recentHeaderList->AddString(path.Path());

Here again, you may use Alt-D to open the result instantly with the matching line selected.

#### Entering a newline, tab.

Tab and Return have a special function in shell windows - they invoke tab completion and execute a selection respectively. To enter a Tab in a Shell/Worksheet window, press Win-Tab. To enter a newline, press Control-Tab or Win-Tab. Note that as with any other keyboard shortcut these are configurable in the UserStartup file, you may for instance remap Execute to the traditional MPW-like Alt-Return if you prefer.

#### Switching a text window into a shell window.

You may turn any window into a shell window quickly by clicking the empty shell icon rectangle in the button bar (rectangle next to the dirty/read only icon). This may be useful if you want to use a shell command in a document but don't want to switch to the worksheet. After you are done with the shell command, switch back to text editing only mode by clicking the shell icon again