Skip to main content
Answer

Extension Attribute to gather VRAM information - Need Help

  • February 1, 2013
  • 3 replies
  • 20 views

Forum|alt.badge.img+4

Has anyone successfully polled the VRAM information through an Extension Attribute? I have been trying the following script without success:

#!/bin/sh

vram='system_profiler -detaillevel mini | grep 'VRAM' | cut -d : -f 2'
echo"<result>$vram</result>"

The command works without a hitch when I use it in Terminal.

Best answer by stevewood

Change your variable quotes from single quotes to grave marks. Grave marks are the button next to the number 1 button on your keyboard. And you will want to add a space after echo.

#!/bin/sh

vram=`system_profiler -detaillevel mini | grep 'VRAM' | cut -d : -f 2`
echo "<result>$vram</result>"

That works for me.

3 replies

stevewood
Forum|alt.badge.img+35
  • Hall of Fame
  • Answer
  • February 1, 2013

Change your variable quotes from single quotes to grave marks. Grave marks are the button next to the number 1 button on your keyboard. And you will want to add a space after echo.

#!/bin/sh

vram=`system_profiler -detaillevel mini | grep 'VRAM' | cut -d : -f 2`
echo "<result>$vram</result>"

That works for me.


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • February 4, 2013

Hi. You could shorten the time it takes to get this piece of data by doing the following instead-

vram=`system_profiler SPDisplaysDataType | grep "VRAM" | cut -d : f 2`

Pulling an entire System Profiler report is a bit slow. I personally try not to use system_profiler because of that.


Forum|alt.badge.img+4
  • Author
  • Contributor
  • February 4, 2013

Thanks Steve! That fixed the issue for me. Mike, using the SPDisplayDataType is indeed much faster and I do believe I will use this instead of -detaillevel mini. Thanks to both of you!