linux - Use pipe line to open a file after it's just created -
i want accomplish quite simple pipeline:
step 1 : cat input1 input2 > output
step 2 : gedit output
i can
cat input1 input2 > output | gedit output
but wonder how can ommit typing name of output file in case? file created cat redirect should file gedit open. thanks!
just define bash
function purpose (perhaps in ~/.bashrc
if want create permanent), e.g.
editcat() { cat $* > output gedit output }
you might want create function more fancy, generating output file temporary file using mktemp(1)
editcat() { local editemp=$(mktemp) cat $* > $editemp gedit $editemp rm $editemp }
but might consider using less(1)
linux pipeline cat gedit
No comments:
Post a Comment