[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: .profile not being src'd at login on uptodate buster



On 4/7/21, Greg Wooledge <greg@wooledge.org> wrote:
> On Wed, Apr 07, 2021 at 03:16:41PM +0000, Lee wrote:
>> On 4/7/21, Gene Heskett <gheskett@shentel.net> wrote:
  <.. snip ..>
>> > Any idea why its not working?
>>
>> A typo in your script?  Add an else clause that shows the error and
>> that will probably show you what's wrong -- eg
>>
>> dir="$HOME/AppImages"
>> if [ -d "$dir" ] ; then
>>   PATH="$dir:$PATH"
>> else
>>   echo "OnNoes!! The directory \"$dir\" does not exist!"
>> fi
>
> Writing error messages to stdout from a .profile isn't generally the
> best idea.  Writing to stderr would be slightly better, but both of
> them should be avoided in a permanent configuration if possible.  Profiles
> that scribble to stdout or stderr during login can break things like scp.

Interesting..  "echo foo" in .bashrc does break scp, but not "echo foo >2"
.. but that doesn't work for bash, so hhrmm.. > /dev/stderr seems to
work in all cases:

$ head -12 .bashrc
lee@izzy:~$ head -12 ~/.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 [ -n "$DEBUG" ]; then
#  don't bother with the rest if I've been here before
   echo "bashrc:  DEBUG already set: $DEBUG" >/dev/stderr
   return
else
   echo ".bashrc: First time here!" >/dev/stderr
fi


> As a *temporary* debugging measure, it's fine.

I don't see any breakage, so I'd disagree with you.  Especially here,
where the test is a belt & suspenders thing because the directory is
always supposed to exist.

Regards,
Lee


Reply to: