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 / chetan
sorry, forgot to keep the "mv" command in my last post.
for i in *.sh
do
n=`echo $i|sed 's/ /-/g'`
mv "$i" $n
done
Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
What does $1 mean in bash?
c program to display the information of given file similar to givan by the unix or linux command ls -l
how to get part of string variable with echo command only?
What are the two files of crontab command?
How do I read a .sh file?
Can you write a script to portray how set –x works?
What is the meaning of $1 in shell script?
How to debug the problems encountered in the shell script/program?
What is a beat in a script?
What is the lifespan of a variable inside a shell script?
Write a shell script to get current date, time, user name and current working directory.
When should shell programming/scripting not be used?
What are the different communication commands available in the shell?
What happens on a system call?
What are scripts in psychology?