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
How will you emulate wc –l using awk?
What command needs to be used to take the backup?
What is the difference between grep and egrep?
Explain how you Automate your application using Shell scripting.
How to print the first array element?
How many fields are present in a crontab file and what does each field specify?
What is a shell? · Types of shell · what is shell scripting?
determine the output of the following command: echo ${new:-variable}
How do I run a script from command prompt?
What is option in shell script?
Write a command sequence to find the count of each word?
Which scripting language is best for automation?
What is shell company all about?
What is computer cli?
What is the default shell of solaris?