How do you rename the files(*.sh) with file names containing space in it?for example "interview question.sh" needs to rename to "interview-question.sh".
Appreciate your inputs.Thanks.
Answer Posted / senthil m
For single file, you can do following command;
mv interview\ question.sh interview-question.sh
For multiple files on the current working folder;
for i in *\ *.sh
do
j=`echo $i|sed "s/ /-/g"`
mv "$i" $j
done
Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
Calculate a real number calculation directly from the terminal and not any shell script.
How will you find the 99th line of a file using only tail and head command?
Can shell script run on windows?
Is bash a shell script?
How do I read a .sh file?
How to check if a directory exists?
Is powershell a language?
What does egrep mean?
What is mac default shell?
What is a file basename?
What is path in shell script?
determine the output of the following command: echo ${new:-variable}
Why is the use of shell script?
What does it mean by #!/Bin/sh or #!/Bin/bash at the beginning of every script?
What is the difference between break and continue commands?