我想测试Hadoop分布式文件系统(HDFS)中是否存在目录.我想创建目录,如果它不存在,否则什么都不做.
当我修改http://jugnu-life.blogspot.com/2012/10/hadoop-fs-test-example.html上的代码时:
#!/bin/bash directory=/raw/tool/ if hadoop fs -test –d $directory ; then echo "Directory exists" else hadoop fs -mkdir $directory echo "Creating directory" fi
我收到错误:
-test: Too many arguments: expected 1 but got 2 Usage: hadoop fs [generic options] -test -[defsz]
我究竟做错了什么?
假设你复制/粘贴了你的例子,那么 - 在d之前是不正确的.我从你的帖子中复制了命令行,注意 - 在一天之前扩展的方式不同.
$ echo -test | od -c 0000000 - t e s t \n $ echo –d | od -c 0000000 342 200 223 d \n