Extension Attribute to gather VRAM information - Need Help

chenderson
New Contributor II

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.

1 ACCEPTED SOLUTION

stevewood
Honored Contributor II
Honored Contributor II

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.

View solution in original post

3 REPLIES 3

stevewood
Honored Contributor II
Honored Contributor II

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
Legendary Contributor III

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.

chenderson
New Contributor II

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!