I have to make a script that will be changing one string with different word in the current directory and all subdirectories in this current directory. I want to replace name Leo with Leonidas in all files in directory and all files in subdirectories.
I have two questions:
Why this script is not changing string in files in subdirectories?
Why this script can be executed only once? When I try to run it for the second time, it's not working.
#!/bin/bash for file in *; do if [[ -f $file ]] && [[ -w $file ]]; then sed -i -- 's/Leo/Leonidas/g' "$file" fi done