3 reputation
3
bio website
location
age
visits member for 2 years, 10 months
seen Aug 28 at 21:33

Feb
12
awarded  Popular Question
Nov
18
comment printf white space character in bash script
I've been editing in Notepad++, then running dos2unix in Cygwin.
Nov
18
revised printf white space character in bash script
More details.
Nov
18
comment printf white space character in bash script
After further investigation, I think there is indeed something else that was causing the error in Cygwin. I again tested using just " " (no SPC variable) in the script, in Cygwin, and now it works. Could be something about my workstation configuration or some other factor. Weird. Again, thank you for pointing out the variable expansion aspect, in general.
Nov
18
revised printf white space character in bash script
Correction to summary.
Nov
18
revised printf white space character in bash script
added 225 characters in body
Nov
18
comment printf white space character in bash script
When I just put spaces in the text, the script does not behave as expected in Cygwin. The script works without the SPC variable (as you suggest getting rid of $SPC) in a true Linux environment like Ubuntu 11.04 (just tested it in that environment). However, have not gotten it to work in Cygwin on Windows XP.
Nov
18
comment printf white space character in bash script
Thank you, rozcietrzewiacz; your suggestion to put the SPC variable into ${SPC} solved the problem.
Nov
18
awarded  Scholar
Nov
18
accepted printf white space character in bash script
Nov
18
comment printf white space character in bash script
Thank you for the comments, suggestions, and information...I changed the assignment: SPC=" " but the result is still not as expected. Initially, I tried the '"URL^Just the mailto URL"' syntax, but it does not work as expected in Cygwin, hence the attempts at using escape characters that represent the whitespace character.
Nov
17
comment printf white space character in bash script
Thank you for the clarification. Similarly, I had previously tried using the value of printf "\040" (octal value) which works at the command line by itself, but using the octal does not work with the script.
Nov
17
awarded  Editor
Nov
17
comment printf white space character in bash script
Added the expected output to my question. Thank you.
Nov
17
revised printf white space character in bash script
Included details of what the expected output should look like.
Nov
17
asked printf white space character in bash script