0

Im looking how to pass an argument in a find file function this should give all the sh files in my computer first the basename a tab with then all the directories For example myBashfile.sh *sh at the moment i have this: while getopts b opt do case $opt in b) find / -name $OPTARG -printf "%f\n"-print 2>/dev/null ;; esac done wich gives only the output of test1.sh test60.sh anothertest.sh

but i need as output: (with a tab) test1.sh /home/directory5/directory6 test60.sh /home/directory50/directory6 anothertest.sh /home/directory5/directory6

can anyone help me please?

mrName
  • 117
  • 1
  • 2
  • 10
  • What have you tried? You should read this : http://meta.stackexchange.com/a/128553 – Seki Jun 08 '12 at 14:16
  • 1
    Tangentially, the shell is going to try to expand `*sh` by looking in your current directory before it is passed to your script. Start with `myBashfile.sh "*sh"` so that your script actually sees the asterisk. – chepner Jun 08 '12 at 14:40

1 Answers1

1

A comprehensive answer and the manuals. In brief:

$1 # means the 1st argument
$2 # means the 2nd argument
$@ # means all arguments
Community
  • 1
  • 1
Vidul
  • 10,128
  • 2
  • 18
  • 20