Autor Tópico: bash: Local diferente  (Lida 3183 vezes)

Offline RPGama

  • Usuário Ubuntu
  • *
  • Mensagens: 7
    • Ver perfil
bash: Local diferente
« Online: 14 de Fevereiro de 2011, 09:52 »
Olá.

Sou adepto do Ubuntu desde o ano passado (10.04), assim como sou desenvolvedor Ruby on Rails pelo mesmo período.

Na época eu usava o ambiente Ruby on Rails (Rails 2.3.8 ) em um notebook e seguia tudo tranquilamente... Até o dia que meu notebook parou de funcionar.

Agora estou usando o Ubuntu 10.10 em casa e, necessitando instalar o ambiente Rails novamente (agora Ruby 1.9.2 e Rails 3.0.4 (acho...)) não consigo pois um dos passos não está sendo possível.

http://evenancio.wordpress.com/2011/01/24/ruby-1-9-2-rails-3-no-ubuntu-10-10/#comment-17

Este é o link para o tutorial que eu utilizei (nos comentários, sou Rodrigo Gama). O fato é que, até certo ponto, tudo corre perfeitamente, mas quando chego aqui:

Citar
"6) Agora precisamos adicionar uma linha no arquivo .bashrc, que será responsável por carregar o RVM. Digite:
echo ‘[[ -s "$HOME/.rvm/scripts/rvm" ]] && source “$HOME/.rvm/scripts/rvm”‘ >> ~/.bashrc" Evandro Venâncio


O terminal me retorna o seguinte erro: ‘[[ -s /home/rodrigo/.rvm/scripts/rvm ]]
bash: “/home/rodrigo/.rvm/scripts/rvm”‘: Arquivo ou diretório não encontrado

Na sessão de comentário, o Evandro ainda tenta me ajudar dizendo que, em um blog que ele consultou, disse que, em caso da instalação do Ubuntu ter sido feita como usuário ROOT, o arquivo .bashrc poderia estar em outro local, e me aconselha a tentar este comando:

echo ‘[[ -s "/usr/local/rvm/scripts/rvm" ]] && source “/usr/local/rvm/scripts/rvm”‘ >> ~/.bashrc

Novamente, sem sucesso... Estou precisando, com urgência, do ambiente rodando aqui, logo estou meio que tentando de tudo.

As perguntas:
1. O que pode causar esse erro?
2. O que eu posso ter feito para que esse erro exista?
3. Como posso corrigir esse erro?

O tutorial é de confiança, logo, descartei erro no tutorial. É certo que o erro esteja em algum lugar por aqui mesmo.

Obrigado por qualquer atenção desprendida à este caso.

EDIT: Caso precisem de qualquer informação adicional, me peçam e terão elas aqui.
« Última modificação: 14 de Fevereiro de 2011, 10:08 por RPGama »

Offline irtigor

  • Equipe Ubuntu
  • Usuário Ubuntu
  • *****
  • Mensagens: 4.344
  • Delete, delete, delete!
    • Ver perfil
Re: bash: Local diferente
« Resposta #1 Online: 15 de Fevereiro de 2011, 15:57 »
Abre o .bashrc, remove o que você colocou lá e acrescenta
Código: [Selecionar]
if [ -s ~/.rvm/scripts/rvm ]; then
    source ~/.rvm/scripts/rvm
fi

Feche o arquivo e abra um terminal.

Offline RPGama

  • Usuário Ubuntu
  • *
  • Mensagens: 7
    • Ver perfil
Re: bash: Local diferente
« Resposta #2 Online: 15 de Fevereiro de 2011, 17:18 »
Olá.

Obrigado por responder a minha pergunta, mas a dúvida perssiste:

Há dois arquivos com nomes parecidos: .bashrc e .bashrc_part2

.bashrc:
Código: [Selecionar]
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
    else
color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
# [ -z "$PS1" ] && return
if [ -s ~/.rvm/scripts/rvm ]; then
    source ~/.rvm/scripts/rvm
fi

# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
    else
color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).

-------------------------------------------------
if [ -s ~/.rvm/scripts/rvm ]; then
    source ~/.rvm/scripts/rvm
fi
-------------------------------------------------

.bashrc_part2
Código: [Selecionar]
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
    else
color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

Onde exatamente eu devo fazer as alterações? Eu tentei no trecho destacado com hífens (os "-" não existem no arquivo original.) no arquivo .bashrc, mas o erro continuou. Há mais alguma coisa que eu deva fazer, que deveria ser óbvia mas que eu não sei.

Agradeço novamente por ter respondido minha pergunta.

Offline irtigor

  • Equipe Ubuntu
  • Usuário Ubuntu
  • *****
  • Mensagens: 4.344
  • Delete, delete, delete!
    • Ver perfil
Re: bash: Local diferente
« Resposta #3 Online: 15 de Fevereiro de 2011, 18:22 »
Só tá faltando atenção, "remove o que você colocou" é que vai sumir a mensagem de erro, o "adiciona" é pra prosseguir o tutorial. Conselho, desfaça tudo e comece do zero, você já tentou várias coisas, sem o menor critério, tanto que o ~/.bashrc nem mesmo tem a linha sugerida no tutorial... tá pra lá de modificado (e no meio já tem as linhas que sugeri).

Uma ultima coisa, linhas de comentário devem começar com cerquilha.

----
Se você só modificou o ~/.bashrc
Código: [Selecionar]
mv ~/.bashrc{,_old}
Ai você verifica se a mensagem de erro continua, se continuar é porque você modificou outros arquivos... se sumir, cria o ~/.bashrc com as linhas que falei e termina o tutorial.
« Última modificação: 15 de Fevereiro de 2011, 18:31 por irtigor »

Offline RPGama

  • Usuário Ubuntu
  • *
  • Mensagens: 7
    • Ver perfil
Re: bash: Local diferente
« Resposta #4 Online: 16 de Fevereiro de 2011, 09:16 »
Olá.

Ok... Mas há alguma maneira de eu saber tudo o que foi instalado pelo apt-get ou aptitude desde que eu comecei a utilizá-lo? Tentei um 'apt-get help' mas nada lá é mostrado...

irtigor, obrigado por toda a ajuda.

Offline irtigor

  • Equipe Ubuntu
  • Usuário Ubuntu
  • *****
  • Mensagens: 4.344
  • Delete, delete, delete!
    • Ver perfil
Re: bash: Local diferente
« Resposta #5 Online: 16 de Fevereiro de 2011, 11:49 »
Olhe os arquivos de log, do apt-get é /var/log/dpkg.log. Outra alternativa é olhar o histórico do terminal ( fc -l 1 | less ), acho até que isso vai ser mais útil, porque também pode apontar os arquivos que você modificou (se concentre nisso, arrumar os arquivos que andou modificando, remover/reinstalar/instalar pacotes não vai mudar aquele erro).

Offline irtigor

  • Equipe Ubuntu
  • Usuário Ubuntu
  • *****
  • Mensagens: 4.344
  • Delete, delete, delete!
    • Ver perfil
Re: bash: Local diferente
« Resposta #6 Online: 16 de Fevereiro de 2011, 12:21 »
Tava revendo... uma coisa, mesmo errando o if (é o que eu acredito que aconteceu), você não deveria receber essa mensagem de erro, porque, seguindo aquele tutorial, o arquivo /home/rodrigo/.rvm/scripts/rvm deveria existir, olhe isso também.