So i use termux and newbie,i want to save -help command from package as txt in internal storage with specific file name Ex:youtube-dl --help,aria2c -h,etc How to do that?
您要做的是称为"输出重定向" 。通过假设我们需要重定向的输出的程序是 youtube-dl
,致发行的完整命令变为
youtube-dl --help &> /sdcard/help.txt
在上面的字符串中, youtube-dl --help
是您想要保存的输出,以及任何所需的参数的程序。 &>
表示"重定向标准输入和标准错误" ;重新启动两者是重要的,因为某些程序将其帮助消息输出到STDERR。 /sdcard/help.txt
是内部存储中的文件,输出将保存。
使用此方法时保管,因为如果它已经存在,则重新重新创建目标文件,因此其内容将丢失。要将新输入连接到已存在的文件,请使用e.g。
youtube-dl --help &>> /sdcard/help.txt
What you want to do is called "output redirection". By assuming the program whose output we need to be redirected is youtube-dl
, the full command to issue becomes
youtube-dl --help &> /sdcard/help.txt
In the above string, youtube-dl --help
is the program whose output you want to save, alongside any needed argument. &>
means "redirect the standard input and standard error"; it's important to redirect both, as some programs output their help message to stderr. /sdcard/help.txt
is a file in the internal storage, where the output will be saved.
Take care when using this method, as the target file will be recreated anew if it already exists, thus its contents will be lost. To concatenate the new input to an already existent file, use e.g.
youtube-dl --help &>> /sdcard/help.txt
© 2022 it.wenda123.org All Rights Reserved. 问答之家 版权所有