シェルスクリプトの作成中に解決できない問題が発生しました。
次のコマンドでこれを見つける必要があります/
。
PATHS_SHELL=$(sudo find / -name '*.sh')
変数に代入せずにコマンドを実行すると正常に動作します。ただし、に割り当てると、PATHS_SHELL
次のテキストで無限ループが発生します。
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 159: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 108: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 124: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 134: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 138: systemctl: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 146: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 149: ps: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 149: grep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 149: wc: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 150: [: : integer expression expected
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 159: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 108: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 124: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 134: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 138: systemctl: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 146: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 149: ps: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 149: grep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 149: wc: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 150: [: : integer expression expected
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 159: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 108: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 124: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 134: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 138: systemctl: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 146: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 149: ps: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 149: wc: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 149: grep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 150: [: : integer expression expected
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 159: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 108: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 124: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 27: seq: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 134: sleep: command not found
/home/kibnakamoto/workspace/Astrobee/scripts/daemon/astrobee/status_leds.sh: line 138: systemctl: command not found
この無限出力の前に、予想され正しい出力であるいくつかのシェルファイルパスが出力されました。例えば
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/ipvs.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/ipip-conntrack-mtu.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/conntrack_tcp_unreplied.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/nft_fib.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/nft_nat_zones.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/nft_meta.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/nft_zones_many.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/nft_concat_range.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/nf_nat_edemux.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/nft_nat.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/netfilter/conntrack_icmp_related.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/livepatch/test-shadow-vars.sh
/usr/src/linux-headers-5.15.0-48/tools/testing/selftests/livepatch/test-livepatch.sh
Ubuntu 22.04を使用しています。
答え1
$PATH
文字列を索引付けするために予約された変数を使用したようです$PATHS_SHELL
。この変数にはコマンドを検索するディレクトリのリストが含まれているため、上書きするとスクリプトコマンドは見つかりません。したがって、コマンドのエラーが見つかりません。