複数のディレクトリでスクリプト (B と言う) を実行するスクリプト (A と言う) を作成する必要があります。スクリプト B は、一連のサブディレクトリでスクリプト (たとえば C) を実行します。私はスクリプト B と C を作成して正常に実行しましたが、それらを組み合わせてスクリプト A を作成するのは、私には少し難しすぎるようです。
Bの例は
MainDir="/home/kkk/mmm/dir"
create_stack="${MainDir}/run/create_stack_and_find_seam.rb"
# cd into the working main directory where all the subdirs are present
for fil_no in $@
do
cd ${MainDir}/${fil_no}
pwd
# the working script
echo ${fil_no}
${create_stack} ${fil_no}
done
# Go back to the original starting directory
cd $OLDPWD
上記のスクリプト (スクリプト B) は、fil_no に登録されている一連のディレクトリで Ruby スクリプト「create_stack_and_find_seam.rb」を実行します。現在、さまざまなレベルで「fil_no」とリストされているさまざまなサブディレクトリを持ついくつかのディレクトリがあります。したがって、すべてのディレクトリでスクリプト B を実行する必要があります。これにより、すべての異なるサブディレクトリで「create_stack_and_find_seam.rb」(スクリプト C) が実行されます。