Solved

Linux Shell Scripting: Mime type without filename

Posted on 2013-11-08
2
200 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
Comment Utility
Add "-b" as a parameter
    file -b -i $f
0
 
LVL 19

Expert Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

10 Experts available now in Live!

Get 1:1 Help Now