My problem is that within this loop, finalfile is formed, but it does not contain anything when both files are present. the echo "go" is also not displayed. How to resolve this problem or rewrite this code?
            Asked
            
        
        
            Active
            
        
            Viewed 22 times
        
    1 Answers
1
            
            
        The issue is : (see the related post below).  Also, you can't pipe to rm.  Here is the corrected code:
if [[ -f file1.csv ]] && [[ -f file2.csv ]]; then
  paste file1.csv file2.csv > finalfile.csv
  rm file1.csv file2.csv
else
  echo "don't go"
  exit 1
fi
See also:
 
    
    
        Community
        
- 1
- 1
 
    
    
        codeforester
        
- 39,467
- 16
- 112
- 140
- 
                    How to remove finalfile.csv at the end if I want to provide different inputs to my file? – reader Mar 19 '17 at 00:34
- 
                    `rm` is your friend. – codeforester Mar 19 '17 at 00:41
