Solved

Shell Scripting: Insert value from website into curl request

Posted on 2013-11-08
1
186 Views
Last Modified: 2013-11-08
Using Linux and Shell Scripting, I want a list of all files along with their mime types.

I get the mime type like this:
file -i filename.txt

Open in new window


This does NOT work:
for f in *; \
do mime=file -i $f; echo "File: $f - Mime: $mime"; \
done

Open in new window

0
Comment
Question by:hankknight
1 Comment
 
LVL 14

Accepted Solution

by:
ThomasMcA2 earned 500 total points
ID: 39633312
Try this:

for f in *; 
do mime=`file -i $f`; echo "File: $f - Mime: $mime"; 
done

Open in new window

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
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.

920 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

12 Experts available now in Live!

Get 1:1 Help Now