0
在ksh中,我试图给我从文件中读取的每个项目添加一些选项标志(-f) 例如。如何给文件中的每个项目添加'-f'标志并保存到变量中?
ls > fileList.txt
// fileList.txt contains
// test1.out
// test2.out
// test3.out
// I tried this but I get this error
// error : -f: not found [No such file or directory]
files=`cat fileList.txt | sed 's/^/-f /'`
// What I want to see is $files show
// -f test1.out -f test2.out -f test3.out
// so I can call another script with this new argument
processFile $files
我该怎么做?
你真的没有''//你的数据线的前面?假设你不那么'files = $(sed's/^/- f /'
shellter
我仍然收到同样的错误.. -f:没有找到[没有这样的文件或目录] –
作为'echo $ files'的结果?你必须逐个把它分开,找出它没有按你期望的那样工作。你是否将std-err重定向到'/ dev/null',以便看不到任何错误消息。你需要使用'files = $(sed's/^/- f /' shellter