I use ZSH for my terminal shell, and although I wrote several functions to automate specific tasks, I never tried anything that requires the functionality that I find at the moment.
I recently rewrote a blog using Jekyll, and I want to automate the blog posts and finally upload the newly created files to my server using something like scp.
I am a bit confused about variable bindings / usage in ZSH; eg:
DATE= date +'20%y-%m-%d' echo $DATE
correctly displays 2011-08-23, as I expected.
But when I try:
DATE= date +'20%y-%m-%d' FILE= "~/path/to/_posts/$DATE-$1.markdown" echo $FILE
It outputs:
2011-08-23 blog.sh: line 4: ~/path/to/_posts/-.markdown: No such file or directory
And when starting up with what I would like to get in the blog title (ignoring the fact that you need to manipulate the line to make it more URL friendly and that the path / path of the route does not exist)
i.e. blog "blog title", outputs:
2011-08-23 blog.sh: line 4: ~/path/to/_posts/-blog title.markdown: No such file or directory
Why print $ DATE over a print call to $ FILE and not the line included in $ FILE?
source share