Bash script
Hi I've got stuck in bash script. I'm writing a script which searches scripts in entered directory and its subdirectories. Scripts are searched on the basis of the first line e.g.: #!/bin/bash or perl,awk,...
My script should display file name,path and script name.
e.g.: if I enter directory "script" it will display
/home/my/script/aaa.sh bash
/home/my/script/first/bbb.pl perl
/home/my/script/second/ccc.sh bash
I've tried this, but no success:
find $directory_name -exec grep -H -l "bash" '{}' \;
- this searches in whole file not just in first line. I was thinking about this "| head -n 1" but don't know how to implement it
- in addition to this I need to display script name
Thanks for help
|