I developed and maintain a ruby gem called Githug and I am trying to write an automated test script for it. Githug basically manipulates a directory to put it into different states of a working git repository and you can execute git commands to “solve” the level.
One of the levels asks you for your git config details and I am doing the following:
#! /bin/sh
# ...snip
#level 4
FULL_NAME=$(git config --get user.name)
EMAIL=$(git config --get user.email)
echo -e "$FULL_NAME\n$EMAIL" | githug
When I execute from a bash script it (echo -e) doesn’t work. But it does when I run it from the terminal.
FULL_NAME=$(git config --get user.name)
EMAIL=$(git config --get user.email)
echo -e "$FULL_NAME\n$EMAIL" | githug
********************************************************************************
* Githug *
********************************************************************************
What is your name? What is your email?
Congratulations, you have solved the level
Why doesn’t this work from the bash script?
Thanks.
Wrong shebang:
When it shall be a bash script, use
Bash has a buildin echo, which isn’t 100% identic with /bin/echo.