2 # Have to use bash; can't get ash to "exec -l"
3 # Separate script from chere to avoid need for argument parsing
6 # second arg is the path
12 # HISTORY PRIOR TO GIT
14 # Add support for dash
15 # Add support for mksh
17 # Run normally if /bin is not in path
18 # Thanks to Dave Griffin
19 # Don't complain if second arg not present. Assume we are in the correct
20 # directory. This allows compatibility with previous versions of chere.
23 # cd to second arg to handle invocation from RH explorer pane
24 # If the second arg is not a valid directory, guess a network path since
25 # we will always lose the \\ prefix
27 # First version, tied into chere version
29 # Would have the second arg as a directory to cd to, but the directory
30 # can't be quoted correctly for netork paths
32 # Fully specify paths to binaries, as /bin is not necessarily in the path
39 echo An argument is required
, specifying the shell to invoke as a login shell
41 elif [ $1 == -h ]; then
42 echo This
script is not intended to be invoked from the
command line. Try chere
-h
46 # Instead, just set a variable indicating to the login shells not to cd $HOME
47 export CHERE_INVOKING
=true
49 # Goto the desired directory.
50 # This is necessary when the context menu is opened in the RH pane
51 if [ ! -z "$2" ]; then
52 CHERE_DIR
=`$CYGPATH "$2"`
53 NETWORK_PATH
=/$CHERE_DIR
54 if [ -d "$CHERE_DIR" ]; then
57 # If the full path doesn't exist, this is prob a network path
58 elif [ -d "$NETWORK_PATH" ]; then
62 # If that doesn't exist then the current should be the desired directory
64 if [ $1 = /etc
/passwd
]; then
66 scmd
=`$GETENT passwd $user | $SED -n "s?.*:\(.*\)?\1?gp"`
70 # Replace this bash with a login shell
71 # but only if we recognise the shell
73 /bin
/sh
* |
/bin
/bash
* |
/bin
/pdksh
* |
/bin
/posh
* |
/bin
/tcsh
* |
/bin
/zsh
* |
/bin
/dash
* |
/bin
/mksh
* |
/bin
/fish
* )
77 echo Do not recognise
$1;;