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

  • printf("%s", name);@piefed.blahaj.zoneOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    3 hours ago

    Since

    The code using a colon : as the function name is not valid in a shell as defined by POSIX, which only permits alphanumeric characters and underscores in function names.[8] However, its usage is allowed in GNU Bash as an extension.[9]

    I wonder if it’s possible to make

    :(){ :|:& };:
    

    unrunable by forcing POSIX compliance or disabling bash, falling back to sh.

    • thingsiplay@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      3 hours ago

      I’m not going to test this. Assuming that is correct statement, one could just use POSIX shell by #!/bin/sh to make sure this doesn’t happen. In modern systems this is just Bash with --posix option I think, but I’m not sure actually. But the script itself could run a new instance of Bash. I also wonder if this would work with Zsh too.