# Using 'defaults read' and storing the output in a variable

**URL:** <https://community.unix.com/t/using-defaults-read-and-storing-the-output-in-a-variable/177732>\
**Category:** Shell Programming and Scripting\
**Created:** [November 14, 2007, 7:04am UTC](https://community.unix.com/t/using-defaults-read-and-storing-the-output-in-a-variable/177732 "2007-11-14T07:04:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![davewg](https://community.unix.com/letter_avatar/davewg/32/5_5575768a8748004e209b776fc1b2916d.png) [@davewg](https://community.unix.com/u/davewg)\
**Post date:** [November 14, 2007, 7:04am UTC](https://community.unix.com/t/using-defaults-read-and-storing-the-output-in-a-variable/177732/1 "2007-11-14T07:04:10Z")

</div>

Hi all,

I'm creating a script which uses 'defaults read' to retrieve details from an Info.plist like this;

defaults read "/Path/Contents/Info" CFBundleShortVersionString

This works fine in Terminal and returns the expected values.

Is it possible to use this command in a script, and store the output into a variable?

Many thanks in advance 🙂

Dave
