且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

/tmp/hive上的Powershell chmod for winutils和hadoop/spark

更新时间:2023-11-21 19:12:16

使用PowerShell环境变量语法($env:VARIABLE)代替批处理语法(%VARIABLE%)应该足够.请注意,您必须使用调用运算符才能使它起作用.我也建议添加双引号,以防路径中有空格.

Using the PowerShell environment variable syntax ($env:VARIABLE) instead of the batch syntax (%VARIABLE%) should suffice. Note that you must use the call operator for this to work. I'd also recommend adding double quotes in case there are spaces in the path.

& "${env:HADOOP_HOME}\bin\winutils.exe" chmod 777 /tmp/hive

对调用运算符的需求似乎是由于PowerShell的命令解析器无法将表达式$variable\something识别为路径.没有&,您将获得例外

The need for the call operator appears to be due to PowerShell's command parser not recognizing an expression $variable\something as a path. Without the & you'd be getting an an exception

表达式或语句中的意外令牌'\ bin \ winutils.exe".

Unexpected token '\bin\winutils.exe' in expression or statement.