linux - Bash 中的 "Spoof"文件扩展名

标签 linux bash

有没有办法在 bash 中“欺骗”文件的文件扩展名以供另一个程序使用?我可以考虑编写一些 shell 脚本并制作大量软链接(soft link),但这不是很可扩展。

假设我有一个我正在尝试使用的程序,它要求输入文件具有特定的文件扩展名,而且它没有关闭此检查的方法。

最佳答案

您可以创建一个具有必要扩展名的 fifo 并将任何其他文件类型cat 放入其中。因此,如果您的疯狂程序需要查看以 .funky 结尾的文件,您可以这样做:

mkfifo file.funky
cat someotherfile > file.funky &
someprogram file.funky

关于linux - Bash 中的 "Spoof"文件扩展名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25166272/

相关文章:

bash - 使用 bash 脚本在 linux/solaris 中进行日志轮换

bash - 连续处理tail -f输出

bash - Git post-receive hook,将 curl 提交消息发送到 Discord Webhook

linux - 在 Linux 中的单个命令行中执行三个命令

linux - linux中fat32的最大容量是多少?

linux - 查找海湾合作委员会位置

linux - 如何最好地将混合编码的邮箱文件转换为 UTF-8?

c - GDB/bin/bash 无法在 Eclipse CDT 中执行应用程序?

arrays - Bash:awk 输出到数组

linux - 如何在通过/bin/bash打开的shell中执行linux命令