If [ "${wc - l | /opt/scratch/Datastage/OutputFiles/Notifications/Alerts_Errors_Output.csv}" = "1" ] ; 'then' rm -f "/opt/scratch/Datastage/OutputFiles/Notifications/Alerts_Errors_Output.csv" fi
(@Execute_Command_34): Executed: If [ "${wc - l | /opt/scratch/Datastage/OutputFiles/Notifications/Alerts_Errors_Output.csv}" = "1" ] ; 'then' rm -f "/opt/scratch/Datastage/OutputFiles/Notifications/Alerts_Errors_Output.csv" fi
Reply=1
Output from command ====>
sh: "${wc - l | /opt/scratch/Datastage/OutputFiles/Notifications/Alerts_Errors_Output.csv}": 0403-011 The specified substitution is not valid for this command.
Welcome!
Please wrap your code between triple-backticks, then it's better readable and not reformatted. Use the small terminal icon at the top of the editor window.
I see several mistakes. You certainly want
fn=/opt/scratch/Datastage/OutputFiles/Notifications/Alerts_Errors_Output.csv
nlines=$( wc -l < "$fn" )
if [ $nlines -le 1 ]
then
rm "$fn"
else
sendmail ...
fi
Use variables to store intermediate results!
$( )
runs a subshell and is substituted by its output.
In [ ]
use -le
for a numerical "less or equal" comparison.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.