The third party scheduling application our enterprise uses doesn't execute rm commands as expected. By this, I mean I expect the rm -f $filetoremove to complete and then continue to the next line of code in the script.
But I need to get it to execute preferrably rm -f.
Is there another method to remove a file without using rm?
I tried > delete_foobar.file but it just empties it without removing.
Additional information:
My work environment is a large enterpise. I write the .sh script which I test outside the scheduling application. Outside the scheduling software, the rm -f $filetoremove command works with a return code of 0. However, the scheduling software does not register the 0 return code and immediately exits without running the remainder of the .sh script. This is problematic and the vendor has acknowledged this defect.
I'm not privy to the details of the automation software nor the exact return codes it receives. All I know, is that my scripts don't run completely, when run via the automation software, if it contains rm. This is why I'm looking for alternatives to rm.
Yes, it is important that I remove the file once I've completed processing it.
rm? – Kusalananda Feb 05 '17 at 07:48rmor if simple has a malformed$PATHenvironment variable. – Kusalananda Feb 05 '17 at 08:19rmwith, the error message ofrm, the value of$PATHwhen the application runsrm. Most probablyrmis working just fine on your system (and there is no better alternative), but the application invokes it incorrectly. – pts Feb 05 '17 at 10:21rmand detect its exit status, then that will likely also be an issue for any of the other ways that people come up with to delete files in the answers to this question. – Kusalananda Feb 05 '17 at 12:22die_file_die_bu_wa_ha_ha_ha_ha.shor whatever you like containing#!bash \n rm -f $1 \n exit 0\n, make sure it's on your path, and use this instead ofrm. (Obviously, replace the\n's with real newlines in your file). – Bob Jarvis - Слава Україні Feb 05 '17 at 14:44rmworks in your script, then I think you'll need help from the scheduler vendor. – Jeff Schaller Feb 05 '17 at 20:25