Reference Bash variable in block


#1

Hi All,

This may be a stupid question, but I have the following in my recipe:

bash ‘get user required’ do
code <<-EOH
GETUSER=$(ls /home | grep “myuser*”)
EOH
end

How do I reference the bash “GETUSER” variable below in my execute block?

execute ‘/tmp/chownMyStuff’ do
command "chown -R GETUSER:staff /tmp/myDir/"
user "root"
action :run
end

Cheers,
Simon


#2

Ignore me, i found a better way of doing it!