简体   繁体   中英

how to find and replace files from .gitignore in bash

i only found how to find strings in files but how can I replace commented lines and how exectly should i replace them?

#!/bin/sh
echo enter file name 
read fname 
exec<$fname 

while read line 
do
    echo $line; 
done 

In order to move the files whose names match patterns give in .gitignore , try the following loop:

while read pattern; do
   echo mv $pattern /var/tempdir
done < .gitignore

If the output of this loop looks like the correct list of commands, remove the word "echo" and run the loop again to actually move the files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM