Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7181095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:29:08+00:00 2026-05-28T17:29:08+00:00

I am on OS X using bash and wanting to read the data in

  • 0

I am on OS X using bash and wanting to read the data in a key embedded in every Application in the Applications directory. The result seems to be the ‘defaults’ command trying to apply itself to the whole list instead of each returned Application.

#!/bin/bash

# appList=$(ls /Applications)

for APPS in "$( ls /Applications )" ; do
        result=$(defaults read /Applications/"$APPS"/Contents/Info DTPlatformBuild)
done

echo result is $result

exit 0

Any help appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:29:08+00:00Added an answer on May 28, 2026 at 5:29 pm

    I am going to go with the below. The text file “appleApps.txt” is simply a listing of the default Apple Applications on a new build to abstain from the search.
    A valid company application will have a new key inserted into the “Info.plist” file with a boolean set to true.
    Thus we now have a mechanism to report on whether user’s are installing their own copies of Applications we already package ourselves.

    #!/bin/bash
    echo " "
    echo " "
    rm -f /tmp/validApps /tmp/notValid
    find /Applications -name "*.app" | grep -v -F -f /Library/Application\ Support/CompanyData/appleApps.txt | while read APP
    do
    appVersion=`defaults read "$APP/Contents/Info" Company 2>/dev/null`
    if test "$appVersion" = 1 ; then
        echo "$APP : $appVersion" >> /tmp/validApps
    else
        echo "$APP" >> /tmp/notValid
    fi
    done
    
    echo " "
    echo " "
    
    result=$(cat -n /tmp/validApps)
    notValidResult=$(cat -n /tmp/notValid)
    
    printf "%s\n" "Our packaged Applications are:" "$result"
    echo " "
    echo " "
    printf "%s\n" "User installed Applications are:" "$notValidResult"
    echo " "
    
    rm -f /tmp/validApps /tmp/notValid
    
    exit 0
    

    Thanks for the tips as far as my errors with $result

    I read up on why not to us ls and have learnt not to do it, as prompted by both @chris and @anubhava

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Every time I run a script using bash scriptname.sh from the command line in
The problem is simple: Using bash, I want to add a directory to my
I'm using GNU bash, version 3.00.15(1)-release (x86_64-redhat-linux-gnu). And this command: echo -e doesn't print
I am playing with using flock , a bash command for file locks to
How does one test for the existence of files in a directory using bash
I need to read MANIFEST.MF maven manifest file from some.jar using bash
I want to change the directory in linux using bash file. Below is the
I'm using bash. Suppose I have a log file directory /var/myprogram/logs/ . Under this
Using bash, is it possibile to send the equivalent of a space bar stroke
Using bash, I have a list of strings that I want to use to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.