gpt4 book ai didi

windows - 用于 winutils 和 hadoop/spark 的 Powershell chmod on/tmp/hive

转载 作者:可可西里 更新时间:2023-11-01 16:25:08 24 4
gpt4 key购买 nike

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

这是一个 Windows 环境,有些人正在抛出曲线球,但这是最糟糕的 :)

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

感谢您的帮助!

最佳答案

使用 PowerShell 环境变量语法 ($env:VARIABLE) 而不是批处理语法 (%VARIABLE%) 应该就足够了。请注意,您必须使用调用接线员才能使其正常工作。我还建议添加双引号以防路径中有空格。

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

调用运算符的需要似乎是由于 PowerShell 的命令解析器无法将表达式 $variable\something 识别为路径。没有 & 你会得到一个异常

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

关于windows - 用于 winutils 和 hadoop/spark 的 Powershell chmod on/tmp/hive,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36698907/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com