嗨我有一个关于喂养输入这个简单的bash脚本我写的问题。它所做的就是在我的编译操作中添加一组标志,以免我每次都必须自己写入它们。我可以使用echo myprogram.c -o myprogram -llibrary | ./Compile
运行它。 但我找不到一种方式来运行它,我期望能够,./Compile < myprogram.c -o myprogram -llibrary
我试过一些引号和括号的组合无济于事,谁能告诉我如何提供相同的输入作为使用重定向输入命令由echo生成。重定向输入与空格分隔
#!/bin/bash
# File name Compile
#Shortcut to compile with all the required flags, name defaulting to
#first input ending in .c
echo "Enter inputs: "
read inputs
gcc -Wall -W -pedantic -std=c89 -g -O $inputs
exit 0