Announcement

Collapse
No announcement yet.

Bash scripting help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bash scripting help

    Running this command on the command line works:
    Code:
    /usr/sbin/softwareupdate --list | egrep '! (MacOSXUpdate|Xcode|QuickTime|iTunes)' | awk '{print $2}' | tr '\n' ' '
    But I can't get the output into a variable in my script:
    Code:
    search_updates='MacOSXUpdate|Xcode|QuickTime|iTunes'
    
    updates=`/usr/sbin/softwareupdate --list | egrep '! ($search_updates)' | awk '{print $2}' | tr '\n' ' '`
    Don't know why the post has a return during iTunes
    Last edited by TnT; 20 July 2004, 16:56.
    Gigabyte GA-K8N Ultra 9, Opteron 170 Denmark 2x2Ghz, 2 GB Corsair XMS, Gigabyte 6600, Gentoo Linux
    Motion Computing M1400 -- Tablet PC, Ubuntu Linux

    "if I said you had a beautiful body would you take your pants off and dance around a bit?" --Zapp Brannigan

  • #2
    Hmm... seems it doesn't like have the $search_updates variable. Works if I just put the stuff directly in there.
    Gigabyte GA-K8N Ultra 9, Opteron 170 Denmark 2x2Ghz, 2 GB Corsair XMS, Gigabyte 6600, Gentoo Linux
    Motion Computing M1400 -- Tablet PC, Ubuntu Linux

    "if I said you had a beautiful body would you take your pants off and dance around a bit?" --Zapp Brannigan

    Comment


    • #3
      Which shell? (not like it'll help me much )

      You may need to export the value:
      Code:
      export search_updates=MacOSXUpdate|Xcode|QuickTime|iTunes
      etc.
      This may be necessary if /usr/sbin/softwareupdate is a shell script, since it would create its own environment.

      - Steve

      Comment


      • #4
        Since search_updates has strange characters in it, you may want to surround its reference in double quotes, like this: "$search_updates"

        Maybe, I'm just guessing...
        Blah blah blah nick blah blah confusion, blah blah blah blah frog.

        Comment

        Working...
        X