inlined shell command and added error handling