In a follow-up question to a question asked yesterday:
I am running the below command in Datastage ETL tool, which executes the script in Linux.
I executed:
for file in /Path/filename_*; do [[ $(wc -l "$file" | cut -d' ' -f1) -eq 1 ]] && rm $file ; done
Reply=0
In this case I'm having empty files in the folder:
for file in /Path/filename_*; do [[ $(wc -l "$file" | cut -d' ' -f1) -eq 1 ]] && rm $file ; done
Reply=1
I don't have empty files in the folder.
Both are same commands with different reply, my job fails if i get reply code 1
do
is a reserved word to be used in afor
loop, which is missing in the command you show. Are you sure this is the complete extract from your shell script? If so, I recommend using shellcheck to debug your script. – AdminBee Jun 26 '20 at 13:59for file in
? If so, please edit your post to include that. Also, you don't mention the syntax error any more, and it is unclear now what the problem really is (what does it mean if you say that the command is not successful any more). Please edit to clarify. – AdminBee Jun 26 '20 at 14:54