Recently learning Gradle, using the git clone command to download some information, but the file name contains a space, it does not seem very comfortable, so think of using shell script to batch it, remove the file name of the space, note that this is to remove all the blanks
git clone https://github.com/waylau/gradle-2-user-guide-demos.git
Shell script:
########################################################################## File name:handle.sh# author:liuwei# Mail: [Email protected]# Created time:2015 November 16 Monday 18:23 22 seconds ##################################################### #####################!/bin/bashfor x in ' ls | TR "" "_" ' dof= "' Echo ${x} | TR "_" "" "" f1= "' echo ${x}| sed ' s/_//g '" #echo $f 1if ["$f"! = "$f 1"]thenmv "$f" "$f 1" fidone
Ideas:
First, the file name with a space is converted to a file name with other characters.
Then, with this file name, you get a variable with a space
Using the MV command
Shell handles files that contain spaces in the file name