[lfs-support] About errors

2013-06-06 Thread Philippe Delavalade
Hi :-)

I prefer a second message for another problem.

On my debian host system, in files .bashrc, i use the following lines to be
informed from errors in a command :

if [ $PS1 ]; then
_prompt_command()
{
 local status=$?;
 if [ $status != 0 ]; then
 echo -n $status  12;
 fi 
}
PROMPT_COMMAND=_prompt_command
fi

So, the exit code is printed before the prompt in case of an error.

I'd like to do so in chapter 6 of LFS but, as there is no .bashrc, I wonder
where I could append this lines.

Thanks for advice.

-- 
Ph. Delavalade
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page


Re: [lfs-support] About errors

2013-06-06 Thread Pierre Labastie
Le 06/06/2013 14:50, Philippe Delavalade a écrit :
 Hi :-)

 I prefer a second message for another problem.

 On my debian host system, in files .bashrc, i use the following lines to be
 informed from errors in a command :

 if [ $PS1 ]; then
  _prompt_command()
  {
local status=$?;
if [ $status != 0 ]; then
echo -n $status  12;
fi
  }
  PROMPT_COMMAND=_prompt_command
 fi

 So, the exit code is printed before the prompt in case of an error.

 I'd like to do so in chapter 6 of LFS but, as there is no .bashrc, I wonder
 where I could append this lines.

 Thanks for advice.

I haven't tried, but I would say that it could go in .bashlogin in 
/root. Then if you use the chroot command of 6.4, .bashlogin is sourced.

Pierre

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page


Re: [lfs-support] About errors

2013-06-06 Thread Philippe Delavalade
Le jeudi 06 juin à 15:48, Pierre Labastie a écrit :
 Le 06/06/2013 14:50, Philippe Delavalade a écrit :
  Hi :-)
 
  I prefer a second message for another problem.
 
  On my debian host system, in files .bashrc, i use the following lines to be
  informed from errors in a command :
 
  if [ $PS1 ]; then
   _prompt_command()
   {
   local status=$?;
   if [ $status != 0 ]; then
   echo -n $status  12;
   fi
   }
   PROMPT_COMMAND=_prompt_command
  fi
 
  So, the exit code is printed before the prompt in case of an error.
 
  I'd like to do so in chapter 6 of LFS but, as there is no .bashrc, I wonder
  where I could append this lines.
 
  Thanks for advice.
 
 I haven't tried, but I would say that it could go in .bashlogin in 
 /root. Then if you use the chroot command of 6.4, .bashlogin is sourced.
 
 Pierre

Thanks but I have just .bash_history in /root.

Did I missed something ?

-- 
Ph. Delavalade
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page


Re: [lfs-support] About errors

2013-06-06 Thread Pierre Labastie
Le 06/06/2013 17:49, Philippe Delavalade a écrit :
 Le jeudi 06 juin à 15:48, Pierre Labastie a écrit :
 Le 06/06/2013 14:50, Philippe Delavalade a écrit :
   _prompt_command()
   {
   local status=$?;
   if [ $status != 0 ]; then
   echo -n $status  12;
   fi
   }
   PROMPT_COMMAND=_prompt_command
 I haven't tried, but I would say that it could go in .bashlogin in
 /root. Then if you use the chroot command of 6.4, .bashlogin is sourced.

 Pierre
 Thanks but I have just .bash_history in /root.

 Did I missed something ?

Sorry, I meant, put the lines from _prompt_command() to 
PROMPT_COMMAND=...
into $LFS/root/.bashlogin (using copy/paste or an editor), and then
chroot using the command on page 6.4.

Pierre


-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page


Re: [lfs-support] About errors

2013-06-06 Thread Aleksandar Kuktin
On Thu, 6 Jun 2013 17:49:18 +0200
Philippe Delavalade philippe.delaval...@orange.fr wrote:

 [snip]
 
 Thanks but I have just .bash_history in /root.
 
 Did I missed something ?
 

Just add it. Or put into $HOME/.bashrc . It doesn't matter if you don't
have the file RIGHT NOW, when you make it, bash will read and use it.

Like this (one of several ways to do this):
$ cat  $HOME/.bashrc  EOF
 your stuff goes in here 
EOF

-- 
You don't need an AI for a robot uprising.
Humans will do just fine.
 --Skynet
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page


Re: [lfs-support] About errors

2013-06-06 Thread Philippe Delavalade
Le jeudi 06 juin à 18:42, Pierre Labastie a écrit :
 Sorry, I meant, put the lines from _prompt_command() to 
 PROMPT_COMMAND=...
 into $LFS/root/.bashlogin (using copy/paste or an editor), and then
 chroot using the command on page 6.4.
 
 Pierre

Yes, I have understood ; but in /$LFS/root I have just .bash_history.

Maybe I can create it as suggest Aleksandar Kuktin.

-- 
Ph. Delavalade
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page