このコマンドをどのように繰り返すのですか?

このコマンドをどのように繰り返すのですか?

私のコードスニペットは次のとおりです。スクリプトがパスが見つからない場合は、現在閉じられます。

[echo "could not find $REPLY, ensure the path is correct and try again"] 

代わりに、この時点でループを実行し、パスへの入力を再び許可しようとします。どうすればいいですか?

while [ $choice -eq 3 ]; do

read choice
if [ $choice -eq 1 ] ; then

    echo "You have chosen to spec....  '/path/../'" 
    read
    if [ -d $REPLY ]; then
        find $REPLY -type f -printf '%TY-%Tm-%Td %.8TT %p\n '| sort -r | head -20
    else 
        echo "could not find $REPLY, ensure the path is correct and try again"
    fi
else

ベストアンサー1

while true; do
    echo "You have chosen to spec....  '/path/../'" 
    read
    if [ -d "$REPLY" ]; then
        find "$REPLY" -type f -printf '%TY-%Tm-%Td %.8TT %p\n '| sort -r | head -20
        break
    else
        echo "could not find $REPLY, ensure the path is correct and try again"
        echo "press enter to continue..."
        read cont
    fi
done

おすすめ記事