Recently, I have been doing a lot of shell scripting to automate some time consuming manual processes. For instance, read configuration using xslt transformation stylesheets. >_O Though it was painful to my eyes, once done I felt bit proud of myself learning something new. (Yes, XSLT you go to my Skills List ^_^)
As part of that process, I had to iterate files in a configuration folder for transformation into .json files. We shall come to that later. Now, let’s see the shell script to list out the files in a folder.
1 | for f in /home/ashokma/ashkeys/config/*; |
Tip: You can strip the extension away from the file using this snippet:
echo -e "File Name with extension - $(basename $(echo "$f" | cut -f 1 -d '.'))"