I just realized that you can run a command at login by appending it to your .bashrc

For instance, I added a curl pointing to a certain address that immediately upon login returns a message that tells me whether I’m connected to my VPN provider or not.

Sorry for the beginner revelation. Just thought it was cool. :3

  • ohshit604@lemmy.halstead.host
    link
    fedilink
    arrow-up
    4
    ·
    5 hours ago

    Your .bashrc loads every time you open a shell (terminal, console, whatever you call it) you should not treat this file as something that only runs once at login.

    • melroy@kbin.melroy.org
      link
      fedilink
      arrow-up
      4
      ·
      3 hours ago

      Yes you right it runs everything you open a shell. bashrc only loads for non-login shells. But I would recommend adding:

      case $- in
          *i*) ;;
            *) return;;
      esac
      

      Which will stop executing bashrc further when its not running interactively.

    • flameleaf@lemmy.ml
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 hours ago

      That’s why I put stuff that only needs to be run once in .xprofile. I assume there’s a Wayland equivalent?