Results 1 to 5 of 5

Thread: script breaks bash prompt

  1. #1
    adelatorre NNTP User

    Default script breaks bash prompt

    The environment is Novell oes2. i.e. SLES 10

    Users can ssh into the oes2 server fine.

    I have created a one line script

    [ `id -gn` = "trax" ] && exec /bin/bash

    If the same user is made a member of group trax and logs in, they do NOT get a bash prompt, only a blinking cursor.

    No commands work at the blinking cursor, although you do see characters echoed when you type.

    ctrl-c closes the session.

    Why is this happening?

    Ideally I want to evolve the script to start a menu

    [ `id -gn` = "trax" ] && exec /usr/local/bin/

    I can execute this script and runs, but if I try to
    execute the menu choice that gives me a shell, I get no bash prompt, and the behavior is the same as above.

  2. #2
    goldie NNTP User

    Default Re: script breaks bash prompt

    adelatorre wrote:
    > The environment is Novell oes2. i.e. SLES 10

    you are, of course, welcome here...and, you might even get good help
    here, as there are a few folks here from time to time who can help, you are welcome to hang out, check back and see..

    but, except for a growing handful of volunteer helpers, most of the
    folks here are relative n00bs fleeing opressive systems and giving
    *openSUSE* a try..

    i guess you are more likely to run into a 'real' hacker over in

    anyway, as a Novell customer, you are entitled to something other than
    the volunteer guesses you are likely to get here..

    Give a hacker a fish and you feed him for a day.
    Teach man and you feed him for a lifetime.

  3. #3
    Join Date
    Jun 2008

    Default Re: script breaks bash prompt

    To begin with goldie is right, but as shells are the same for openSUSE and SLES, maybe we can help you.

    But I think I am missing some points.
    First there is no such thing as a one line script. There should at least be two lines
    [ `id -gn` = "trax" ] && exec /bin/bash
    or any other shell/interpreter you think your script must be run by in the shebang on the first line.

    You say a connection is made and a user logs in. Then, as in a miracle, you say they do not get a bash prompt, because of this script. But you never told tre script was even called. Please explain if the script is called, and when yes, where it resides and how it is called. In other words, we need all the information you omitted, maybe because you thought that we at openSUSE are clairvoyant like your SLES friends
    Henk van Velden

  4. #4
    adelatorre NNTP User

    Default Re: script breaks bash prompt

    In sles 9 you could create a script to run out of profile.d which used the exec function.

    The same script in sles 10 does not work.

    How to recreate
    create in /etc/profile.d

    contents of

    exec /bin/bash

    In sles 9 you will get a bash prompt

    In sles 10 you will have blinking cursor

    Behavior is the same whether or not you have the hashpling as the first line of the script.

  5. #5
    Join Date
    Jun 2008

    Default Re: script breaks bash prompt

    When it is realy something do do with the difference between SLES 9 and SLES 10, that might be beyond our (openSUSE based) competence. You will most certain be better served at the Novell forums about SLES/SLED at NOVELL FORUMS as goldie already pointed out to you.

    I did not say that the missing #! is the cause of the problem, but that you in any case need a proper one, else you can not call it a shell script. This with the motto: We do things correct, or we do not do them at all.

    When you want that we carry on trying helping you you realy must be more talkative.

    When you do not use the exec, what is the shell you normaly get? In other words, which shell is interpreting your profile.d?

    When you want particular users getting bash on login (instead of some other shell), why do you not configure that in their /etc/passwd entry?

    I did not go and spend a lot of time reading the bash man page, but when bash is started from exec, I am not sure that it starts as a login-shell. When it is not login shell a lot of environment variables (including the prompt string) mat not be set.
    Henk van Velden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts