1 script in Windows, the path is backslash \, in Linux, the path is slash/, you need to replace the backslash with a slash, using the SED command, as followsSed-i "s:\\\:\/:g"/home/pp/install.sql replaces \ sed-i "S:04risk\::ig" in/home/pp/install.sql file *.sql Replace the 04risk\ in all SQL files with null and case-insensitive, and the parameter I indicates case-insensitive.
2 Displays the results of the Linux command execution, using the echo $ (Linux command) or the Keng number, Keng is the character on the left side of keyboard 1, not single quotes. For example, display the current path, echo $ (PWD), or echo ' pwd ' 3) to get the current directory path, basename $ (PWD) 4) for the loop to read the directory and its subdirectories #! /bin/bash function Read_dir () {for file in ' ls ' does if [-D $/' $file]//Note there must be a space between here, otherwise it will be an error then//replace all SQL files with backslashes sed-i "s:\\\:\/:g"/"$file"/"*.sql Read_dir $"/"$file else echo $ "/" $file fi Done}
Read_dir $