consider you have invokeShellCommandWithParam(userinput) { shell('head "-' + escape(userinput) + '"'); }