I have a script that copies a file from one directory to another indefinitely (until cancelled) as a test.  I am trying to write a bash script that takes file.xml, copies it to a directory, but increments the filename each time, i.e. file1.xml, file2.xml, etc.  I've been coming up short thus far with the solutions I've found on SE.  Any help would be appreciated.
- 
        What are you testing with that, the page cache...?Hauke Laging– Hauke Laging2021-11-23 15:56:19 +00:00Commented Nov 23, 2021 at 15:56
 
                    
                        Add a comment
                    
                 | 
            
                
            
        
         
    1 Answer
#! /bin/bash
source_path='/path/to/file.xml'
dest_dir_path='/path/to/dest'
i=1
while true; do
    cp "$source_path" "${/path/to/dest}/file${i}.xml"
    ((i++))
done
    - 
        Appreciate it. That is way better than the nightmare I tried.Dijitaljedi– Dijitaljedi2021-11-23 18:08:13 +00:00Commented Nov 23, 2021 at 18:08