Hi everyone,

I'm trying to figure out how to pipe a filepath to the open command in TC Shell.
What I'm trying to do is, to pipe the outcome of "which" (to find the current location of another script) to the default text editor.
I tried which testscript.pl | open -e which doesn't do anything. which testscript.pl | open -f opens up the text editor but only displays the path and filename of the script in a new textfile, instead of displaying the file itself.

Anyone an idea of how to do that? I tried to google it, but didn't really find anything useful...
Thanks in advance.
Cheers
Windkessel

Recommended Answers

All 2 Replies

Piping works, if you can do this open -e /path/to/file

That is, if you just type in the " open -e ", it gives you some kind of prompt for a filename.

If it doesn't do that, then piping isn't the answer.

Most things do however accept a filename on the command line, which you would use as open -f `which testscript.pl` Note these are back-ticks, not ' '

Cheers. I was looking for exactly something like that. Added it to my TC Shell aliases using: alias wopen 'printf "opening: "; which \!*; open -e `which \!*`' # wopen: which open

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.