Using bash to create a directory in HDFS if the directory does not exist
Answer #1 100 %Assuming you copied/pasted your example, the - before the d is incorrect. I copied the the command lines from your post, notice how the - before the day expands differently.
$ echo -test | od -c
0000000 - t e s t \n
$ echo ?d | od -c
0000000 342 200 223 d \n