Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[RISOLTO] strano problema prompt in terminale X
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian)
View previous topic :: View next topic  
Author Message
curson
n00b
n00b


Joined: 23 Sep 2006
Posts: 11
Location: London, UK

PostPosted: Thu Oct 12, 2006 10:23 am    Post subject: [RISOLTO] strano problema prompt in terminale X Reply with quote

Salve :)
Non sono nuovo al mondo Linux, ma nuovo al monto Gentoo (che mi ha però conquistato al volo :D).
Ieri ho installato sul mio vecchio portatile Gentoo (seconda installazione della mia vita, la prima sull'altro portatile), tutto bene (il sistema è ancora in fase di configurazione, ma è ok) se non fosse che fin dal primo avvio di X mi sono ritrovato a notare un comportamento alquanto anomalo del prompt in emulazione terminale.
Di seguito un'immagine come esempio del problema:

http://www.the-shrike.net/screen1_prompt.png

Come si nota, sia il prompt dell'utente root che tutto l'output a video (del precedente ls, Password: ed exit) vengono correttamente allineati al bordo sinistro del terminale, cosa che inspiegabilmente non accade per la prima riga del prompt relativo all'utente curson. La seconda è shiftata da me in fase di configurazione di $PS1 per ovviare all'obrobrio estetico aggiungendoci uno spazio davanti, mentre la prima è assolutamente senza spazio:
Code:
in ~/.bashrc
export PS1="\[\033[01;31m\](\e[0m\d \t\[\033[01;31m\])-[\u\e[0m@\h\[\033[01;31m\]]-(\w\[\033[01;31m\])\n |=>\e[0m"


Tutto ciò accade con qualsiasi tema si applichi a $PS1, qualsiasi sia il terminale X (Eterm, xterm, aterm) ma solo quando l'utente è diverso da root. In console tutto è normale, tanto è vero che è la seconda riga ad essere giustamente shiftata a destra di 1 spaziatura, che è poi quella aggiunta da me per allineare le due righe del prompt nel terminale X.

Il sistema è fresco di installazione, Gentoo 2006.1, kernel compilato da sorgenti Gentoo 2.6.17-gentoo-r8, fluxbox 1.0_rc2-r2 (stesso problema con 0.9.15.1-r1), nel caso dello screenshot usavo Eterm 0.9.3.
Grazie in anticipo per ogni informazione a riguardo :)
ciaoooo!
_________________
curson :twisted:
"There are those who worship it. There are those who fear it.
And there are those who have vowed to destroy it.
In the Valley of the Time Tombs the Shrike waits for them all."


Last edited by curson on Thu Oct 12, 2006 1:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Thu Oct 12, 2006 12:03 pm    Post subject: Reply with quote

hai provato con una PS1 standard come questa:
Code:
PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "

:?:
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
curson
n00b
n00b


Joined: 23 Sep 2006
Posts: 11
Location: London, UK

PostPosted: Thu Oct 12, 2006 12:58 pm    Post subject: Reply with quote

Sì, problema invariato. Aggiunge sempre uno spazio tra il bordo sinistro e l'inizio della riga di prompt.
Succedeva anche con il prompt standard configurato in installazione da Gentoo, fin dal primo avvio di X.
Curiosissimamente frustrante :D
_________________
curson :twisted:
"There are those who worship it. There are those who fear it.
And there are those who have vowed to destroy it.
In the Valley of the Time Tombs the Shrike waits for them all."
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Thu Oct 12, 2006 1:10 pm    Post subject: Reply with quote

mmmm strano....
prova a postare il tuo /etc/profile e il .bashrc :roll:
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
curson
n00b
n00b


Joined: 23 Sep 2006
Posts: 11
Location: London, UK

PostPosted: Thu Oct 12, 2006 1:17 pm    Post subject: Reply with quote

/etc/profile (non ho modificato nulla, tranne $EDITOR)
Code:
# Load environment settings from profile.env, which is created by
# env-update from the files in /etc/env.d
if [ -e /etc/profile.env ] ; then
        . /etc/profile.env
fi

# 077 would be more secure, but 022 is generally quite realistic
umask 022

# Set up PATH depending on whether we're root or a normal user.
# There's no real reason to exclude sbin paths from the normal user,
# but it can make tab-completion easier when they aren't in the
# user's PATH to pollute the executable namespace.
#
# It is intentional in the following line to use || instead of -o.
# This way the evaluation can be short-circuited and calling whoami is
# avoided.
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
        PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
else
        PATH="/usr/local/bin:/usr/bin:/bin:${PATH}"
fi
export PATH
unset ROOTPATH

# Extract the value of EDITOR
[ -z "$EDITOR" ] && EDITOR="`. /etc/rc.conf 2>/dev/null; echo $EDITOR`"
[ -z "$EDITOR" ] && EDITOR="/bin/vim"
export EDITOR

if [ -n "${BASH_VERSION}" ] ; then
        # Newer bash ebuilds include /etc/bash/bashrc which will setup PS1
        # including color.  We leave out color here because not all
        # terminals support it.
        if [ -f /etc/bash/bashrc ] ; then
                # Bash login shells run only /etc/profile
                # Bash non-login shells run only /etc/bash/bashrc
                # Since we want to run /etc/bash/bashrc regardless, we source it
                # from here.  It is unfortunate that there is no way to do
                # this *after* the user's .bash_profile runs (without putting
                # it in the user's dot-files), but it shouldn't make any
                # difference.
                . /etc/bash/bashrc
        else
                PS1='\u@\h \w \$ '
        fi
else
        # Setup a bland default prompt.  Since this prompt should be useable
        # on color and non-color terminals, as well as shells that don't
        # understand sequences such as \h, don't put anything special in it.
        PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
fi

for sh in /etc/profile.d/*.sh ; do
        if [ -r "$sh" ] ; then
                . "$sh"
        fi
done
unset sh


~/.basrch
Code:
# Test for an interactive shell.  There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
        # Shell is non-interactive.  Be done now!
        return
fi

# Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
if [[ -f ~/.dir_colors ]]; then
        eval `dircolors -b ~/.dir_colors`
else
        eval `dircolors -b /etc/DIR_COLORS`
fi

# Change the window title of X terminals
case ${TERM} in
        xterm*|rxvt*|Eterm|aterm|kterm|gnome)
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}>\007 "'
                ;;
        screen)
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\ "'
                ;;
esac

# Custom prompt
RED="\[\033[01;31m\]"
BLUE="\[\033[01;34m\]"
CYAN="\[\033[0;36m\]"
LGREEN="\[\033[01;32m\]"
WHITE="\e[0m"
GREY="\[\033[0;37m\]"
export PS1="$RED($WHITE\d \t$RED)-[\u$WHITE@\h$RED]-($WHItE\w$RED)\n|=>$WHITE "

# Custom command
alias ls="ls -ahl --color"
alias dir="dir -a --color"

PATH=$PATH:$HOME/bin

export LC_MESSAGE="en_US"


Qui l'unica cosa che potrebbe in qualche modo influire credo sia la parte "change window title in...", anche se non vedo come. E' una funzione che era implementata di default (testata ;) suppongo) e che non ho modificato in alcun modo.
_________________
curson :twisted:
"There are those who worship it. There are those who fear it.
And there are those who have vowed to destroy it.
In the Valley of the Time Tombs the Shrike waits for them all."
Back to top
View user's profile Send private message
curson
n00b
n00b


Joined: 23 Sep 2006
Posts: 11
Location: London, UK

PostPosted: Thu Oct 12, 2006 1:26 pm    Post subject: Reply with quote

curson wrote:
~/.basrch
Code:

[...cut...]

# Change the window title of X terminals
case ${TERM} in
        xterm*|rxvt*|Eterm|aterm|kterm|gnome)
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}>\007 "'
                ;;
        screen)
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\ "'
                ;;
esac

[...cut...]


Scemo come sono, vedo le cose e non le correggo da solo :D
Bè, il problema sta effettivamente in quella "funzione" di cambio titolo delle finestre del terminale.
Alla fine delle due righe, c'è uno spazio (dopo \007 e dopo \033\\) che apparentemente rimaneva a sporcare il mio prompt. Commentando la funzione, il problema si risolve, cancellando quello spazio: anche.
Strano comunque che fosse così "in partenza", è un .bashrc che è stato modificato sì, ma non in quelle sezioni, ed è quindi il default da installazione.
Grazie per avermi indirizzato nella direzione giusta! :) - CIAO!
_________________
curson :twisted:
"There are those who worship it. There are those who fear it.
And there are those who have vowed to destroy it.
In the Valley of the Time Tombs the Shrike waits for them all."
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum