Quantcast
Channel: Active questions tagged fish - Stack Overflow
Viewing all articles
Browse latest Browse all 106

Fish Abbreviation to Run Heredocs in Bash

$
0
0

I am trying to write an abbreviation that will do the following:

if there is << in the whole buffer somewhere, it will enclose it with bash -c "<the-buffer>"

So, If I run

tee $HOME/Desktop/test << ENDI am testing!END

it will run the following instead.

bash -c "tee $HOME/Desktop/test << ENDI am testing!END"

The code I came up with is:

function run_in_bash    # Run the command in bash    bash -c "(commandline --current-buffer)"endabbr --add run_in_bash_abbr --regex '.*<<.*' --function run_in_bash

But now when I am running:

tee $HOME/Desktop/test << ENDI am testing!END

It says fish: Expected a string, but found a redirection. What can i do here?


Viewing all articles
Browse latest Browse all 106

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>