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

for i in *.sh
do
echo $i|sed 's/ /-/g'
done

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does $$ mean in shell script?

577


How to get the first line from a file using just the terminal?

595


What language is bash written in?

559


What does $@ mean in shell?

590


What is bourne shell scripting?

531






one folder contains lot of students name but I want to fetch hello with every student name individually using shell script

511


What does .sh file contain?

548


What is computer cli?

497


What is option in shell script?

556


Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.

2029


Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.

1851


What is path in shell script?

636


What is sh in shell script?

573


How to print all the arguments provided to the script?

553


How do I run a .sh file?

613