getopts
ベース名なしでディレクトリ名を表示する方法に関する情報を探しています。これにより、コンピューター内のすべての sh ファイルに、最初にベース名、タブ文字、次にすべてのディレクトリが与えられます。
たとえば、次のようにします。myBashfile.sh -e *sh
出力として表示する必要があります:
test1.sh /home/directory5/directory6
test60.sh /home/directory50/directory6
anothertest.sh /home/directory5/directory6
現時点で私はこれを持っています:
while getopts b opt
do
case $opt in
b) find / -name $OPTARG -printf "%f\n"-print 2>/dev/null ;;
esac
done
これだけが表示されます:
test1.sh
test60.sh
anothertest.sh