For example I have this script that is meant to tweet from the shell, but I'm not sure I'm passing the variable correctly.


echo "tweet>"
read tweet

curl -u user:pass -d status="$tweet" http://twitter.com/statuses/update.xml

I'm not sure what is the correct way to do this in bash. I'm also curious if i can get the echo statement and the prompt for input to appear on the same line.

  • 1
    It depends upon the API, but your implementation is correct within the scope of the actual question.
    – DopeGhoti
    May 12, 2017 at 21:39

1 Answer 1


That is the correct way for BASH scripting.

For input being on the same line, see this answer.


read -p "tweet>" tweet

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .