Solved

Linux Shell Scripting: Mime type without filename

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AWK:  END { statements } 2 35
Redhat upgrade 1 69
Granting root permissions to a user (in Debian Jessie) 17 86
http response code 3 39
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:
Suggested Courses

752 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