1

After the command :set equalprg=echo.sh, the equals command simply deletes the specified region. Here is echo.sh:

#!/bin/bash
echo "$1"

Where is the input? I can assign equalprg to something like astyle and it works fine, taking text from vim on stdin. So why is there nothing on stdin for a bash script? The same thing happens when setting formatprg to a bash script too.

1 Answer 1

3

$1 isn't stdin. It's the first argument passed to the script.

There's various different ways to read from stdin in bash. Here's one:

VALUE=$(cat)
echo "$VALUE"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.