#!/bin/bash echo "Enter the local file path: " read local_file echo "Enter the HDFS file path: " read hdfs_file echo "Choose an action:" echo "1. Append to existing file" echo "2. Overwrite existing file" read action if [ $action -eq 1 ]; then hdfs dfs -appendToFile $local_file $hdfs_file echo "File appended successfully." else hdfs dfs -put -f $local_file $hdfs_file echo "File uploaded successfully." fi
时间: 2024-04-06 13:28:23 浏览: 121
这是一个bash脚本,它会提示用户输入本地文件路径和HDFS文件路径,然后让用户选择要执行的操作:追加到现有文件或覆盖现有文件。如果用户选择追加,脚本将使用hdfs dfs -appendToFile命令将本地文件追加到HDFS文件中。如果用户选择覆盖,脚本将使用hdfs dfs -put命令将本地文件上传到HDFS文件并覆盖现有文件。最后,脚本会输出相应的成功信息。
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)