Cogger

String-Replacement.sh

Nov 17th, 2022 (edited)
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. string_replacement () {
  2. for i in *;do
  3. if
  4. [[ "$i" == *"${k}"* ]];then
  5. rename "s/${k}/${l}/g" "$i"
  6. fi
  7. done
  8. }
  9.  
  10. # replace anything in the k variable with anything in the l variable
  11. # limited to a single directory
  12. # k=""
  13. # l=""
  14. # string_replacement
  15.  
Advertisement
Add Comment
Please, Sign In to add comment