jeudi 19 octobre 2017

validate prompt output against hdfs directory

I'm creating a prompt script that will validate if the output directory exists in the hdfs directory. This is what I came up with

while true; do
    read -l -p  "What is the table name ?" table_name
    case '$table_name' in
       * ) if (( $(hdfs dfs -test -d /user/hive/bar/foo/$test_table) )) ; 
           then echo "ok"; else echo "not ok"; fi ;;
       * ) echo "$table_name";;
    esac
done

This is not working. I don't get any errors but the output is always "not ok" ever if the condition is true. Any help would be appreciated

Aucun commentaire:

Enregistrer un commentaire