# Problema con Gnome-terminal

## Blease87

Ciao a tutti!

Sono sicuro che il mio problema è banalissimo, ma non riesco a venirne a capo!

Da un pò di tempo, ogni volta che apro una shell (in gnome-terminal), mi compare l'errore "-bash: ﻿#: command not found".

Dunque, mi ricordo di aver editato il file di configurazione /etc/bash/bashrc aggiungengo la riga export PATH=$PATH:/home/blease/Scripts.

Gli altri file di configurazione mi sembrano a posto!

Comunque posso sempre postarli!

Ho anche provato a cancellare la directory di gnome-terminal e a reinstallarlo, ma niente!

Sapreste da dove partire?

Grazie a tutti!

----------

## cloc3

secondo me, al 99% c'è un refuso in .bashrc, tuttavia, potresti provare un'indagine più ampia con il comando:

```

# strace -f -e open sh -l

```

dovrebbe darti una lista inclusiva di tutti i file di configurazione utilizzati dalla tua shell.

----------

## Blease87

Ciao,

Sei stato gentilissimo!

Ho analizzato i file riportati dal comando strace, ma non sono riuscito a trovare l'inghippo...

Anch'io credo che il vero problema sia in bashrc o in /etc/profile.

Ti posto il contenuto dei due file, magari intravedi qualcosa che non va.

Questo è /etc/bash/bashrc:

# /etc/bash/bashrc

#

# This file is sourced by all *interactive* bash shells on startup,

# including some apparently interactive shells such as scp and rcp

# that can't tolerate any output.  So make sure this doesn't display

# anything or bad things will happen !

# 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

# Bash won't get SIGWINCH if another process is in the foreground.

# Enable checkwinsize so that bash will check the terminal size when

# it regains control.  #65623

# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)

shopt -s checkwinsize

# Enable history appending instead of overwriting.  #139609

shopt -s histappend

# Change the window title of X terminals 

case ${TERM} in

	xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)

		PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'

		;;

	screen)

		PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'

		;;

esac

use_color=false

# Set colorful PS1 only on colorful terminals.

# dircolors --print-database uses its own built-in database

# instead of using /etc/DIR_COLORS.  Try to use the external file

# first to take advantage of user additions.  Use internal bash

# globbing instead of external grep binary.

safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM

match_lhs=""

[[ -f ~/.dir_colors   ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"

[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"

[[ -z ${match_lhs}    ]] \

	&& type -P dircolors >/dev/null \

	&& match_lhs=$(dircolors --print-database)

[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true

if ${use_color} ; then

	# Enable colors for ls, etc.  Prefer ~/.dir_colors #64489

	if type -P dircolors >/dev/null ; then

		if [[ -f ~/.dir_colors ]] ; then

			eval $(dircolors -b ~/.dir_colors)

		elif [[ -f /etc/DIR_COLORS ]] ; then

			eval $(dircolors -b /etc/DIR_COLORS)

		fi

	fi

	if [[ ${EUID} == 0 ]] ; then

		PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '

	else

		PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '

	fi

	alias ls='ls --color=auto'

	alias grep='grep --colour=auto'

else

	if [[ ${EUID} == 0 ]] ; then

		# show root@ when we don't have colors

		PS1='\u@\h \W \$ '

	else

		PS1='\u@\h \w \$ '

	fi

fi

# Try to keep environment pollution down, EPA loves us.

unset use_color safe_term match_lhs

export PATH=$PATH:/home/blease/Scripts

Questo è /etc/profile:

# /etc/profile: login shell setup

#

# That this file is used by any Bourne-shell derivative to setup the

# environment for login shells.

# 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/nano"

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

Grazie in anticipo!

----------

## cloc3

 *Blease87 wrote:*   

> Ciao,
> 
> Sei stato gentilissimo!
> 
> Ho analizzato i file riportati dal comando strace, ma non sono riuscito a trovare l'inghippo...
> ...

 

mi dispiace. però è difficile leggere l'output che hai incollato, sia perché è troppo lungo, sia perché non hai usato il bbcode.

oltre a un errore di script, il problema potrebbe dipendere da una impostazione sbagliata delle variabili d'ambiente (quelle di sistema sono contenute in /etc/env.d ).

spesso, per capire il livello a cui guardare, si prova a creare un utente di prova e a fare login in una homedir vergine.

se l'esisto è negativo vuol dire che la /etc è a posto ...

----------

