The script was using 'local' keyword outside of function scope, which caused "local: can only be used in a function" error when running test-phase2.sh. Removed 'local' from three variable assignments (device_id and logs) at script top level, as 'local' is only valid inside functions in bash/zsh.