简体   繁体   English

在别名中执行第一个命令后,将相同的文件路径传递给命令

[英]passing the same file path to command after first command is done executing in an alias

I am dumping make test output to a text file 我将make test输出转储到文本文件

make test > & ~/Desktop/makeTestOutput.txt

now I want to make an alias in a way that once the make test dumping is done the path ~/Desktop/makeTestOutput.txt should be used by next command I made fetest interpret and present readable data in Terminal. 现在,我想以一种方式进行别名,以便在完成make测试转储后,我让fetest解释的下一个命令应使用~/Desktop/makeTestOutput.txt路径,并在Terminal中呈现可读数据。

I was thinking to do this make test > & $1 | fetest $1 我正在考虑进行此make test > & $1 | fetest $1 make test > & $1 | fetest $1 but that doesnt pipe the file path to fetest . make test > & $1 | fetest $1但这并不将文件路径传递给fetest

Aliases handle arguments automatically and it is not possible to do what you want with simply using aliases. 别名会自动处理参数,仅使用别名就无法做您想做的事情。 You should use functions instead. 您应该改用函数。 Check here for more details: https://unix.stackexchange.com/questions/3773/how-to-pass-parameters-to-an-alias 在此处查看更多详细信息: https : //unix.stackexchange.com/questions/3773/how-to-pass-parameters-to-an-alias

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在执行第一个命令后执行命令 - Executing a command after the first command executed 批处理文件在 mvn 命令后停止执行 - Batch file stops executing after mvn command 如何在bashrc文件中为别名命令动态设置路径的一部分 - How to set part of a path dynamically for alias command in bashrc file 从 alias 命令中获取第一个参数并将其插入到文件扩展名中 - Take first argument from alias command and interpolate it to file name extension 查找可执行路径,无论它是别名还是命令 - Find executable path regardless if it is an alias or a command OS X终端命令用于解析别名的路径 - OS X terminal command to resolve path of an alias Bash 脚本将环境变量作为命令传递但不执行? - Bash script passing environment variable as a command but not executing it? 使用多个命令运行循环文件,当第一个命令上一个文件完成时运行下一个文件 - Run for loop files with multiple commands, run next file when first command previous file done 在'for file in;中排除一个文件; 做; 完成'命令 - exclude one file in 'for file in ; do ; done' command 在执行我的执行Shell命令的程序后,Shell不响应第一个输入字符 - Shell doesn't respond first input character after executing my program which executes shell command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM