LINUX.ORG.RU

screen: как заставить запускать /etc/profile.d/*


0

0

Всем здрасьте.

Мне нужно, чтобы при старте системы был объявлен

alias gvim="gvim --servername GVIM --remote-silent"
я создал файл /etc/profile.d/gvim.sh, туда добавил этот алиас. И все работает. Только не в GNU screen :(

Как мне заставить screen тоже запускать все файлы из /etc/profile.d ?

Пробовал добавлять в ~/.screenrc:

deflogin on

- нет эффекта

shell -$SHELL
- тоже не работает :(

Помогите!

должно работать. /etc/profile читает шелл, а не скрин. какой $SHELL? можно попробовать явно

$ cat > /myshell
exec bash -l «$@»

и «shell /myshell»

gavv
()
Ответ на: комментарий от gavv

должно, да не обязано. В общем, не работает, хоть тресни. шелл - bash. пробовал указывать явно

shell -/bin/bash

все равно не работает.

dimonomid
() автор топика
Ответ на: комментарий от dimonomid

даже если явно передать '-l' ? тогда только если в самом /etc/profile /etc/profile.d/* как-нибудь криво запускаются ..

gavv
()
Ответ на: комментарий от gavv

слуш, а попробуй пожалуйста у себя такое провернуть? Сделать какой-нить файл, в котором будет объявляться алиас.

Потом запускаем новый konsole, проверяем:

dimon@hp_pavilion:~$ alias gvim
alias gvim='gvim --servername GVIM --remote-silent'

алиас работает. Потом запускаем screen:

screen -l

и проверяем опять:

~$ alias gvim
bash: alias: gvim: not found
теперь ниче не работает. А то так все говорят «должно работать», а у самих-то может и не заработает..

З.Ы. дистр Slackware

Заранее спасибо всем

dimonomid
() автор топика
Ответ на: комментарий от dimonomid

по-моему, варианта два, либо не вызывается «bash -l», лиюо косяк в /etc/profile. потому что если bash -l вызывается, то /etc/profile вызывается точно

gavv
()
Ответ на: комментарий от gavv

видимо, не вызывается таки «bash -l», ибо если был бы косяк в /etc/profile, то мой алиас нигде не работал бы, а он таки работает.. только в скрине не хочет..

dimonomid
() автор топика
Ответ на: комментарий от gavv

неа, не получилось: если сделать так, то screen вообще запустится, строки приглашения не будет, несколько секунд пройдет, и он вывалится [screen is terminating]

кстати, когда я запускаю konsole, то, видимо, как раз запускается bash -l , и при этом он в начале выдает рандомную цитату откуда-нибудь, а в screen ниче подобного нет. Что тоже есть показатель того, что bash -l не запускается. :(((( блин! че ему нужно еще?!

в /etc/profile вот что:

# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.

# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"

alias gvim="gvim --servername GVIM --remote-silent"

# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
  export INPUTRC=/etc/inputrc
fi

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"

# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH.  Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
  echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
  if [ ! $? = 0 ]; then
    PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
  fi
fi

# I had problems with the backspace key using 'eval tset' instead of 'TERM=',
# but you might want to try it anyway instead of the section below it.  I
# think with the right /etc/termcap it would work.
# eval `tset -sQ "$TERM"`

# Set TERM to linux for unknown type or unset variable:
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
 TERM=linux
fi

# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
  VISUAL=emacs
#  VISUAL=gmacs
#  VISUAL=vi
fi

# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
 PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
 PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
 PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
 PS1='$ '
else
 PS1='\u@\h:\w\$ '
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2

# Default umask.  A umask of 022 prevents new files from being created group
# and world writable.
umask 022

# Notify user of incoming mail.  This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
 biff y 2> /dev/null
fi

# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
  if [ -x $profile_script ]; then
    . $profile_script
  fi
done
unset profile_script

# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
 PATH="$PATH:."
fi

dimonomid
() автор топика
Ответ на: комментарий от dimonomid

в общем, свою проблему с алиасом я решил добавлением алиаса в ~/.bashrc , а чтобы не дублировать этот алиас в /etc/profile, добавил в /etc/profile:

source ~/.bashrc

dimonomid
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.