/tmp/hive上的Powershell chmod for winutils和hadoop/spark [英] Powershell chmod on /tmp/hive for winutils and hadoop/spark

查看:194
本文介绍了/tmp/hive上的Powershell chmod for winutils和hadoop/spark的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试将用于在测试堆栈上设置Spark/Hadoop的过程合并到我们的Powershell脚本中.

I'm currently trying to incorporate a process for setting up Spark/Hadoop on a teststack into our powershell script.

这是一个Windows环境,有几处抛出曲线球,但这是最糟糕的:)

It's a windows environment and a few bits are throwing curveballs, but thsi is the worst :)

当我手动安装时,可以从命令行运行%HADOOP_HOME%\bin\winutils.exe chmod 777 /tmp/hive,但是现在我需要将其转换为Powershell脚本,这有可能吗?我已经提出了解决方案,但尚未找到解决方案.一篇文章建议使用icacls,但不允许/tmp/hive作为arg.

When I manually install I can run %HADOOP_HOME%\bin\winutils.exe chmod 777 /tmp/hive from the command line but I now need to translate that into Powershell script, is this possible at all? I've serached but not yet come across a solution. One post suggested using icacls but then /tmp/hive is not allowed as the arg.

感谢您的帮助!

推荐答案

使用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.

这篇关于/tmp/hive上的Powershell chmod for winutils和hadoop/spark的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆