iwgetid in script returns "" [solved]

Forum Forums New users New Users and General Questions iwgetid in script returns "" [solved]

  • This topic has 4 replies, 3 voices, and was last updated Oct 7-8:54 am by Vincent17.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #27750
    Member
    Vincent17

      I have a startup script that needs to know when I’m on home wifi. I use [[ $(iwgetid -r) = "my ssid" ]] && a=home || a=away
      This works on a command line or if the script is run from a terminal, but if the script is run by clicking its icon, or in my case, from .jwm/Startup, then $(iwgetid) returns “” and always a=away. Can someone explain what’s going on?

      antiX-17.3.1_386-base Helen Keller 27 December 2018
      rox/jwm (just like Puppy 🙂

      P.S. I ask here, not on StackExchange because this script works as expected in MX, puppy and a couple of others.
      iwconfig, ifconfig behave the same way.

      • This topic was modified 3 years, 7 months ago by Vincent17. Reason: clarity, additional info
      • This topic was modified 3 years, 7 months ago by Vincent17.
      #27802
      Member
      Vincent17
        Helpful
        Up
        0
        ::

        This works:
        [[ $(/sbin/iwgetid -r) = "my ssid" ]] && a=home || a=away
        Would still appreciate an explanation

        #27806
        Forum Admin
        anticapitalista
          Helpful
          Up
          0
          ::

          Is sbin in $PATH? (type $PATH in a terminal)

          Philosophers have interpreted the world in many ways; the point is to change it.

          antiX with runit - leaner and meaner.

          #27815
          Member
          wildstar84
            Helpful
            Up
            0
            ::

            Generally /sbin contains “system” commands and isn’t in user’s paths, and shouldn’t be, but is in root’s path. Rather than adding it to your path, it’s best to just fully qualify the command if running as a user.

            #27821
            Member
            Vincent17
              Helpful
              Up
              0
              ::

              Is sbin in $PATH?

              Yes.

              it’s best to just fully qualify the command

              lesson learned!

              Thanks.

              EDIT: test.sh contains xmessage $PATH
              $ ./test.sh yields /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin
              click on icon yields /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
              ??

              • This reply was modified 3 years, 7 months ago by Vincent17. Reason: curiosity
            Viewing 5 posts - 1 through 5 (of 5 total)
            • You must be logged in to reply to this topic.