lundi 12 janvier 2015

Getting the shellscript to display a chosen file extension


I'm new to this with shellscript and Linux and now I'm stuck. I shall write a simple program that allows me to search for andy file extension I want and then display how many of them there are. I've been searching the net and read the book I've got but i just can't figure it out.


This is what I got so far:



#!/bin/bash

#Program to search for how many of specific file extension there is in this directory.

echo "Write the file extension you want to search for:"
read n

for n in `ls *.txt` ; do
echo $n
done


How do I continue from here?


Thanks!



Aucun commentaire:

Enregistrer un commentaire