Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #286639

Re: Sourcing of .profile

From Greg Wooledge <greg@wooledge.org>
Newsgroups linux.debian.user
Subject Re: Sourcing of .profile
Date 2026-05-14 13:30 +0200
Message-ID <MUCql-542x-3@gated-at.bofh.it> (permalink)
References <MUwuB-50im-3@gated-at.bofh.it> <MUA5b-52oe-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, May 14, 2026 at 10:51:53 +0200, Nicolas George wrote:
> if [ -f "$HOME/.profile" ] ; then
>   . "$HOME/.profile"
> fi
> 
> A -f instead of -e would exclude symlinks.

-f will follow the symlink and report on whether the target is a
regular file.

hobbit:~$ ln -s .profile symlink
hobbit:~$ ls -l .profile symlink
-rw-r--r-- 1 greg greg 1419 Mar 16  2023 .profile
lrwxrwxrwx 1 greg greg    8 May 14 07:27 symlink -> .profile
hobbit:~$ [ -f symlink ] && echo true
true

As bash's "help test" says:

    All file operators except -h and -L are acting on the target of a symbolic
    link, not on the symlink itself, if FILE is a symbolic link.

Back to linux.debian.user | Previous | NextPrevious in thread | Find similar


Thread

Sourcing of .profile Brieuc Desoutter <brieuc.desoutter@gmail.com> - 2026-05-14 07:10 +0200
  Re: Sourcing of .profile <tomas@tuxteam.de> - 2026-05-14 07:40 +0200
    Re: Sourcing of .profile Brieuc Desoutter <brieuc.desoutter@gmail.com> - 2026-05-14 08:40 +0200
      Re: Sourcing of .profile Anssi Saari <anssi.saari@debian-user.mail.kapsi.fi> - 2026-05-14 09:50 +0200
        Re: Sourcing of .profile <tomas@tuxteam.de> - 2026-05-14 09:50 +0200
      Re: Sourcing of .profile tomas@tuxteam.de - 2026-05-14 09:50 +0200
      Re: Sourcing of .profile Chris Green <cl@isbd.net> - 2026-05-14 10:50 +0200
  Re: Sourcing of .profile Nicolas George <george@nsup.org> - 2026-05-14 11:00 +0200
    Re: Sourcing of .profile <tomas@tuxteam.de> - 2026-05-14 11:40 +0200
      Re: Sourcing of .profile Brieuc Desoutter <brieuc.desoutter@gmail.com> - 2026-05-14 12:10 +0200
        Re: Sourcing of .profile tomas@tuxteam.de - 2026-05-14 12:30 +0200
    Re: Sourcing of .profile Greg Wooledge <greg@wooledge.org> - 2026-05-14 13:30 +0200

csiph-web