Reputation: 33
I'm writing a shell script where I'm setting some variables, but I'd like to echo them to be certain they're correct. However I'm getting a blank line. Does anyone know why this happens because the syntax seems correct.
#!/bin/bash
set var='test'
echo $var
Since I'm on a windows machine I'm using cygwin to test my script.
Upvotes: 0
Views: 1959
Reputation: 11556
Your script should be:
#!/bin/bash
var='test'
echo $var
set can be used to set shell attributes, not variables.
Upvotes: 2
Reputation: 1871
I used to get this issue on machines where I tried to upgrade cygwin. If you upgraded cygwin or installed additional components try reinstalling cygwin.
Upvotes: 0