Solved

Linux Shell Scripting: Mime type without filename

Posted on 2013-11-08
2
208 Views
Last Modified: 2013-11-08
for f in *
do 
  mime=`file -i $f`
  echo $mime
done

Open in new window

How can I get it to return something like:
text/plain; charset=us-ascii
insteead of:
file.txt: text/plain; charset=us-ascii
0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 19

Accepted Solution

by:
simon3270 earned 500 total points
ID: 39633964
Add "-b" as a parameter
    file -b -i $f
0
 
LVL 19

Expert Comment

by:simon3270
ID: 39633978
I've just answered this in another of your questions - do you want to close this as a duplicate question?
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question