As many have replied to you there are many things you have to learn.

But you have made a good beginning.

Keep going.

Some general observations:

1) Your shell scripting style is not typical. Learn from others and improve.

2) Even the file command is not always accurate.

3) Learn to look at return values of commands in the $? variable

4) You can escape spaces and other metacharacters in many ways. I normally
 do a single pass rename of all files using mmv or even mv.

Example.

$ mmv -v "* *" '#1_#2'

Read mmv man page.

-Girish

On Sun, Mar 25, 2012 at 10:02 PM, Bharath Kumar
<[email protected]> wrote:
> Hi ILUGC members,
>
> I have written a shell script to find out what type of file is the file I am 
> searching for. If the resultant file name doesnt have any gap (like 
> /path/name/Bharath_file.txt) I get the result correctly. But if the file has 
> a gap (like /path/name/Bharath Kumar Letter.pdf) I get simply "ERROR". Is 
> there any bug ?? Please help me resolve the bug please ??
>
> This is my code snippet :
>
> #!/bin/bash
> echo -e "Input the file that you want to search: c"
> read input
> find ~ -name ${input}
> echo -e "Input the file that you want: c" // Comments : I will copy the file 
> with the full name that I want
>                                           //to find out what type of file it 
> is
> read input1
> file ${input1}| cut -d: -f 2
>
>
> Thanks,
> Bharathkumar A.V.
> _______________________________________________
> ILUGC Mailing List:
> http://www.ae.iitm.ac.in/mailman/listinfo/ilugc



-- 
G3 Tech
Networking appliance company
web: http://g3tech.in  mail: [email protected]
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to