I write a shell script named as test.sh :
#!/bin/bash
read MY_NAME
echo $MY_NAME
When i execute by file, such as:
./test.sh
everything is ok, but if i execute it by string ,such as:
cat ./test.sh | sh
there is nothing output. Read command did not work when I Execute command using string. How can i fixed it ?
So, if i want execute the script with string and read some value from the stdin, how to work ?