1
I am trying to run a very simple script on a few different platforms:
#!/bin/bash
STRING="this is a test"
echo $STRING
, and I cannot tell why on Mavericks and Yosemite I get the output:
./starter.sh line 2: is": command not found
while an online Bash terminal simulator (sorry, I don't have any Linux setup handy, so I am using: this) runs the code as expected. According to Apple's own primer docs this should work. IOW, double-quotes are simply ignored.
A few points:
- there are no spaces in-between variable name, equals operator and assigned value;
- escaping spaces is not a valid answer in my case, as the end goal is to make some more complicated scripts...but obviously I must "graduate" this small step first.
I think you have a hidden control character or something after the is. This works perfectly fine on my macs running Yosemite. Open up the file in vim and type
:set list
. – yoonix – 2015-08-10T20:39:38.930Thank you, @yoonix, I was sure my whitespaces were right, but this deff. steered me in the right direction. – elder elder – 2015-08-11T09:39:12.060