Solved

Linux Shell Scripting: Mime type without filename

Posted on 2013-11-08
2
201 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
  • 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now