Today, the brothers of the school said that there is a way to delete the space in the file name. Such problems are like my lazy casual people are the favorite. So the full mouth agreed to try it.
Our network center has a FreeBSD server for school UNIX enthusiasts to log in to learn, and the network center can be new member inside. This server is maintained by me, recruiting a new person is also responsible for me.
In order to facilitate management and teaching, I plan to build a PUB directory in the / home directory, and then build a symbolic connection in each user's directory. All materials or tests, etc. can be placed in the PUB. But so many users can't connect the symbolic connection one by one?
The solution at the time was such that read from / etc / passwd, read out the main directory of each user, and then use a for loop to create a symbolic action, the entire order can be completed once:
#For homedir in `Grep 'home' / etc / passwd | awk -f: '{print $ 6}'`; do ln -s / home / pub $ homedir / pub; done;
I would like to complete the task last time, so I think it is a little nervous this time. Originally removed, you can pass the file, you can pass the file name to the SED, the SED will deal with the content of the file instead of the file name. After passing the file name through the variable, the shell will handle each paragraph divided into a different file, set up for half a day, finally use the following command.
Export IFS = ":"; for i in $ (ls); Do MV $ I `Echo $ I | SED 'S / / / G'.; DONE; Export IFS =" "
The key points out that ":" is used as a split, so the shell does not disconnect spaces in the file.