OESF Portables Forum

Everything Else => General Support and Discussion => Zaurus General Forums => Archived Forums => Software => Topic started by: shturm on December 13, 2004, 03:01:13 am

Title: Default Shell In Konsole
Post by: shturm on December 13, 2004, 03:01:13 am
I've downloaded tcsh (as part of package armutils), and set it as my default shell (in /etc/passwd). When I connect to my Z via ssh, I can see that tcsh is indeed my default shell now.
However, when I start opie-embeddedkonsole, it still launches bash.
Is there a way to change this?
Title: Default Shell In Konsole
Post by: kakos on April 02, 2005, 04:15:41 am
Create a file called ".profile" in your home directory.  In it, put the path to your shell of choice (/usr/local/bin/tcsh for example).  That worked for me.
Title: Default Shell In Konsole
Post by: gfdsa on April 13, 2005, 08:26:22 am
Quote
Create a file called ".profile" in your home directory.  In it, put the path to your shell of choice (/usr/local/bin/tcsh for example).  That worked for me.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=73238\"][{POST_SNAPBACK}][/a][/div]
that will spawn 2 shells, bash/sh and tcsh as child
Title: Default Shell In Konsole
Post by: MB Zaurus on April 16, 2005, 07:44:10 pm
Quote
Quote
Create a file called ".profile" in your home directory.  In it, put the path to your shell of choice (/usr/local/bin/tcsh for example).  That worked for me.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=73238\"][{POST_SNAPBACK}][/a][/div]
that will spawn 2 shells, bash/sh and tcsh as child
[div align=\"right\"][a href=\"index.php?act=findpost&pid=74935\"][{POST_SNAPBACK}][/a][/div]

Yes, that will spawn 2 shells. It's also a bad idea (from the standpoint of *nix administration) to have root's .profile blindly call or exec another shell. If the system is corrupted and you need to boot into single-user mode to do disk recovery, you don't want a .profile that launches another shell.

Try the following script. Note that you'll need to change $MYSHELL, and you may want to eliminate the section where root's $HOME directory is reassigned. This is useful in a Solaris environment where root's home directory is /.


#################################################
/bin/echo "bash? [Y|n]\c"
read ans
if [ "X$ans" = "X" -o  -z $ans -o  "X$ans" = "Xy" -o "X$ans" = "XY" ] ; then
        MYSHELL=/usr/bin/bash
        if [ "$SHELL" != "$MYSHELL" ] ; then
                MYSHELLCMD="-c"         # option to run a single command
                                        #       bash            -c
                                        #       [t]csh          -e

                MYSHELLLOGIN="--login"  # otion to specify a login shell
                                        #       bash            --login
                                        #       [t]csh          -l

                /bin/ls /tmp> /dev/null 2> /dev/null
                # OK, the system isn't hosed... continue
                if [ $? -eq 0 ] ; then
                        if [ -x $MYSHELL  ] ; then
                                $MYSHELL $MYSHELLCMD "exit 0"
                                if [ $? -eq 0 ] ; then
                                        # The shell was able to execute something
                                        if [ -d /export/home/root ] ; then
                                                HOME=/export/home/root ; export HOME
                                        fi

                                        if [ -d /home/root ] ; then
                                                HOME=/home/root ; export HOME
                                        fi

                                        export MYSHELL
                                        SHELL=$MYSHELL ;  export SHELL
                                        cd
                        echo "exec()ing $MYSHELL $MYSHELLLOGIN"
                            exec $MYSHELL $MYSHELLLOGIN
                                else
                                        # If we get to here, then we couldn't start up
                                        # the chosen shell...but we've still got /sbin/sh
                                        # as our shell...

                                        echo "Could not run $MYSHELL"
                                fi
                        fi
                fi
        fi
fi
#################################################

Mark